* run in command line: 'LC_ALL=C ifconfig en0 | awk '/ether/{print $2}''. 	23.1.2022 	15:02:55 	lx 	(1. Application process)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/table/db_connection_preference.json'. 	23.1.2022 	15:02:55 	lx 	(1. Application process)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/preference/auth/connection.json'. 	23.1.2022 	15:02:55 	lx 	(1. Application process)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/.nc-env.json'. 	23.1.2022 	15:02:55 	lx 	(1. Application process)

    Connected to: 'postgre local socket, /tmp, database: fi_demo, user: manage_demo'. 	23.1.2022 	15:02:55 	lx 	(1. Application process)

  database connect time: 0.0004 seconds. 	23.1.2022 	15:02:55 	lx 	(1. Application process)

* connect: connection changed to 'postgre-demo/fi_demo'. 	23.1.2022 	15:02:55 	lx 	(1. Application process)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/preference/table/prf/group.json'. 	23.1.2022 	15:02:55 	lx 	(1. Application process)

* preference 'system/nc_server_start.json' was loaded from database 'postgre local socket, /tmp, database: fi_demo, user: manage_demo'. 	23.1.2022 	15:02:55 	lx 	(1. Application process)

Käynnisteään Tcp palvelin 2. 	23.1.2022 	15:02:55 	_lx_SERVER 	(5. palvelin)

* run in command line: 'LC_ALL=C ifconfig en0 | awk '/ether/{print $2}''. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/table/db_connection_preference.json'. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/preference/auth/connection.json'. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/.nc-env.json'. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

    Connected to: 'postgre local socket, /tmp, database: fi_demo, user: manage_demo'. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

  database connect time: 0.0003 seconds. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

* connect: connection changed to 'postgre-demo/fi_demo'. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

* paths:
 - main: '/Users/pasi/nc/nc-server/'
 - bin : '/Users/pasi/4D/mg_v19/Manageri_v19/Resources/bin/bin_osx_arm64/'
 - pref: '/Users/pasi/nc/nc-server/preference/'
 - 4D  : '/Users/pasi/4D/mg_v19/Manageri_v19/'
. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/preference/table/prf/group.json'. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

poll.expand_fds: 50, old fds: nil, new fds: cdata<struct pollfd *>: 0x013d6b1c90, size: 400. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

********************* /Users/pasi/nc/nc-server/ *********************. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

port: 5949, arguments: '[
	5949
]', nc-server.json: '[]'. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

nc_server: debugLevel(0):0  port(5959):5949  closeConnection(0):0. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

1. Loading plugin: nc/worker/auth_worker. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

2. Loading plugin: nc/worker/query_worker. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

3. Loading plugin: nc/worker/query4d_worker. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

4. Loading plugin: nc/worker/call4d_worker. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

All plugins have been loaded. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

* cached preference files: demo-fi_demo-0 - system/option.json, demo-fi_demo-0 - table/prf/field_type.json, demo-fi_demo-0 - system/4d.json. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

* run in command line: 'ifconfig | grep -E 'inet.[0-9]' | grep -v '127.0.0.1' | awk '{ print $2}''. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

* run in command line: 'LC_ALL=C ifconfig en0 | awk '/ether/{print $2}''. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

Mac address: f84d896921dc. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

TLS certificate files: /Users/pasi/nc/nc-server/preference/cert/cert.pem, /Users/pasi/nc/nc-server/preference/cert/privkey.pem. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

NC tcp server waiting on:  http://127.0.0.1:5949/,  http://192.168.32.2:5949/
                          https://127.0.0.1:5949/, https://192.168.32.2:5949/. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

NC udp server waiting on: 127.0.0.1:5949/, 192.168.32.2:5949/. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

--- server started in 0.0019 seconds, 2022-01-23 15:02:57, used memory 3022.2 kb --- 	 5. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

OSX arm64, using: rapidjson-arm, lfs-ffi. 	23.1.2022 	15:02:57 	lx 	(5. palvelin)

1. uri: HTTP, POST '/rest/nc/query/sql4d' 2022-01-23 15:03:06
'POST /rest/nc/query/sql4d HTTP/1.1
Content-Type: application/json
Connection: keep-alive
User-Agent: nc-rest-sql
Authorization: Basic ???
Content-Encoding: lz4
Accept-Encoding: lz4
Content-Length: 815
Content-Uncompressed-Length: 1188

LZ4. 	23.1.2022 	15:03:06 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/.nc-env.json'. 	23.1.2022 	15:03:06 	lx 	(5. palvelin)

    Connected to: 'Manageri v12 plg4d local, , database: plg4d, user: manage_demo'. 	23.1.2022 	15:03:06 	lx 	(5. palvelin)

  database connect time: 0.0001 seconds. 	23.1.2022 	15:03:06 	lx 	(5. palvelin)

* connect: connection changed from 'postgre-demo/fi_demo' to 'plg4d/plg4d'. 	23.1.2022 	15:03:06 	lx 	(5. palvelin)

4D: SELECT so.record_id FROM sales_order so WHERE so.project_id <> '' LIMIT 500 INTO :_lx_atExe1
 - original query: SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id FROM sales_order so  WHERE so.project_id <> ''  ORDER BY so.sales_order_id DESC  LIMIT 500  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8
 - result _lx_atExe1 size: 500, first value: '2001066'
 - query name: new:form/nc/erp-sync/woocommerce/query-local/order-sales.json. 	23.1.2022 	15:03:07 	_lx_ExecuteSqlNew 	(5. palvelin)

 1. answer time: 00:00:00.02045
  
SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id
 FROM sales_order so
 WHERE so.project_id <> ''
 ORDER BY so.sales_order_id DESC
 LIMIT 500. 	23.1.2022 	15:03:07 	lx 	(5. palvelin)

 -- tcp answer 1, send count: 5, loop count: 4, bytes sent 342010 / 342010, 0 remaining, total send time 197 µs. 	23.1.2022 	15:03:07 	lx 	(5. palvelin)

*** tcp close for sock 77, type 'nil', protocol 'HTTP', reason: 'POLLHUP', request length: 1 086 bytes ***. 	23.1.2022 	15:05:15 	lx 	(5. palvelin)

closing socket '77'. 	23.1.2022 	15:05:15 	lx 	(5. palvelin)

*** tcp close for sock 77, type 'nil', protocol 'nil', reason: 'POLLHUP', request length: (no request) bytes ***. 	23.1.2022 	15:10:58 	lx 	(5. palvelin)

closing socket '77'. 	23.1.2022 	15:10:58 	lx 	(5. palvelin)

4D: SELECT _prf.record_id FROM _preference _prf WHERE name_id = '_code_SiteCode' INTO :_lx_atExe1
 - original query: SELECT text_value FROM _preference WHERE name_id = '_code_SiteCode'  INTO :_lx_atExe1
 - result _lx_atExe1 size: 1, first value: 'ZZY0'
 - query name: new:dsql.sqlExecuteUnsafe. 	23.1.2022 	15:11:24 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT _prf.record_id FROM _preference _prf WHERE name_id = 'code_default.json' INTO :_lx_atExe1
 - original query: SELECT text_value FROM _preference WHERE name_id = 'code_default.json'  INTO :_lx_atExe1
 - result _lx_atExe1 size: 1, first value: '{
  "code": {
    "_CODE_ALFLD": [4002, 4002, 4002, 4013, 4013, 4013, 8011, 8011, 10004, 11005, 17004, 17004, 17004, 17004, 17004, 17004, 21001, 21001, 21001, 21001, 21001, 21001, 26002, 27001, 28008, 28008, 29001, 29001, 31001, 31001, 31011, 32002, 32002, 33001, 37001, 37001, 42001, 43002, 44012, 44031, 44031, 44032, 48036, 50001, 54001],
    "_CODE_ASFLDNAME": ["[Tosite]TUNNUS", "[Tosite]Tosite ID", "[Tosite]TUNNUS", "[Tosite]Tositenumero", "[Tosite]Tositenumero", "[Tosite]Tositenumero", "[Var'
 - query name: new:dsql.sqlExecuteUnsafe. 	23.1.2022 	15:11:25 	_lx_ExecuteSqlNew 	(5. palvelin)

sql: Error -1, Table 'JSON_DATA' is not declared in the FROM clause. (SQLS 1103)
Failed to validate column 'PRO_FORMA_NUMBER'. (SQLS 1717)
Failed to validate INSERT command. (SQLS 1727)
Table 'JSON_DATA' is not declared in the FROM clause.Failed to validate INSERT command. (SQLS 1103)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, json_data.pro_forma_number, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti S-Market Tuulos
Tuulosentie 1
14810 TUULOS', '7000', 'Nieminen Markku
Maaherrantie 23
14820 Tuulos
0505275803, make62@gmail.com', '7000', '{
  "total": "25.50",
  "total_tax": "4.93",
  "number": "5916",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "customer_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36",
  "customer_note": "",
  "billing": {
    "address_2": "",
    "city": "Tuulos",
    "postcode": "14820",
    "first_name": "Markku",
    "last_name": "Nieminen",
    "state": "",
    "phone": "0505275803",
    "country": "FI",
    "company": "",
    "email": "make62@gmail.com",
    "address_1": "Maaherrantie 23"
  },
  "tax_lines": [
    {
      "rate_code": "FI-ALV.-1",
      "label": "alv.",
      "rate_id": 1,
      "id": 7294,
      "tax_total": "3.48",
      "shipping_tax_total": "1.45",
      "compound": false,
      "meta_data": []
    }
  ],
  "shipping": {
    "address_2": "",
    "city": "Tuulos",
    "postcode": "14820",
    "first_name": "Markku",
    "last_name": "Nieminen",
    "state": "",
    "country": "FI",
    "company": "",
    "address_1": "Maaherrantie 23"
  },
  "payment_method": "paytrail",
  "transaction_id": "4120e6dadc",
  "fee_lines": [],
  "coupon_lines": [],
  "refunds": [],
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5916"
      }
    ],
    "customer": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/customers/681"
      }
    ]
  },
  "date_paid_gmt": "2021-10-05T15:54:27",
  "status": "completed",
  "date_completed": "2021-10-08T06:55:26",
  "date_completed_gmt": "2021-10-08T03:55:26",
  "cart_hash": "c469a0a67c88f96b67dd52f554de4b75",
  "meta_data": [
    {
      "key": "is_vat_exempt",
      "value": "no",
      "id": 242042
    },
    {
      "key": "_woo_carrier_agent_id",
      "value": "6371",
      "id": 242043
    },
    {
      "key": "_woo_carrier_agent_meta",
      "value": {
        "title": "Automaatti S-Market Tuulos",
        "distance": "4.1",
        "city": "TUULOS",
        "street_address": "Tuulosentie 1",
        "postcode": "14810",
        "logo_url": "",
        "country": "FI",
        "carrier": "matkahuolto",
        "id": "6371",
        "street_address2": ""
      },
      "id": 242044
    },
    {
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496116FI\";s:6:\"weight\";d:0.1000000000000000055511151231257827021181583404541015625;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}",
      "id": 242097
    }
  ],
  "order_key": "wc_order_iSZ14D3Ak7G15",
  "currency": "EUR",
  "line_items": [
    {
      "taxes": [
        {
          "subtotal": "2.322576",
          "total": "2.322576",
          "id": 1
        }
      ],
      "total": "9.68",
      "sku": "WE_TAHETA",
      "id": 7291,
      "product_id": 968,
      "meta_data": [],
      "name": "Putkenpäähela, harmaa, Ø14mm, 2kpl/pss",
      "variation_id": 0,
      "price": 4.8387,
      "tax_class": "",
      "subtotal": "9.68",
      "total_tax": "2.32",
      "subtotal_tax": "2.32",
      "quantity": 2
    },
    {
      "taxes": [
        {
          "subtotal": "1.16136",
          "total": "1.16136",
          "id": 1
        }
      ],
      "total": "4.84",
      "sku": "WE_RE_VÄHE",
      "id": 7292,
      "product_id": 914,
      "meta_data": [],
      "name": "Välihela, harmaa, 2kpl/pss",
      "variation_id": 0,
      "price": 4.839,
      "tax_class": "",
      "subtotal": "4.84",
      "total_tax": "1.16",
      "subtotal_tax": "1.16",
      "quantity": 1
    }
  ],
  "customer_id": 681,
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "instance_id": "5",
      "total": "6.05",
      "id": 7293,
      "taxes": [
        {
          "subtotal": "",
          "total": "1.452",
          "id": 1
        }
      ],
      "total_tax": "1.45",
      "method_title": "Matkahuolto Lähellä-paketti",
      "meta_data": [
        {
          "key": "Tuotteet",
          "value": "Putkenpäähela, harmaa, Ø14mm, 2kpl/pss &times; 2, Välihela, harmaa, 2kpl/pss &times; 1",
          "id": 53972
        }
      ]
    }
  ],
  "date_created": "2021-10-05T18:52:28",
  "created_via": "checkout",
  "date_created_gmt": "2021-10-05T15:52:28",
  "date_paid": "2021-10-05T18:54:27",
  "date_modified": "2021-10-08T06:55:26",
  "payment_method_title": "Paytrail",
  "date_modified_gmt": "2021-10-08T03:55:26",
  "id": 5916,
  "discount_total": "0.00",
  "discount_tax": "0.00",
  "shipping_total": "6.05",
  "version": "3.6.2",
  "shipping_tax": "1.45",
  "parent_id": 0,
  "cart_tax": "3.48"
}', '', '', 'Nieminen Markku
Maaherrantie 23
14820 Tuulos', '5916', 'AV', 'TI', 'HV', 20.57, '', '20220123.151124.3a001.so_  zzy9f84d896921dcrr', 'K', 4.93)
'
INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, json_data.pro_forma_number, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti S-Market Tuulos
Tuulosentie 1
14810 TUULOS', '7000', 'Nieminen Markku
Maaherrantie 23
14820 Tuulos
0505275803, make62@gmail.com', '7000', '{
  "total": "25.50",
  "total_tax": "4.93",
  "number": "5916",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "customer_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36",
  "customer_note": "",
  "billing": {
    "address_2": "",
    "city": "Tuulos",
    "postcode": "14820",
    "first_name": "Markku",
    "last_name": "Nieminen",
    "state": "",
    "phone": "0505275803",
    "country": "FI",
    "company": "",
    "email": "make62@gmail.com",
    "address_1": "Maaherrantie 23"
  },
  "tax_lines": [
    {
      "rate_code": "FI-ALV.-1",
      "label": "alv.",
      "rate_id": 1,
      "id": 7294,
      "tax_total": "3.48",
      "shipping_tax_total": "1.45",
      "compound": false,
      "meta_data": []
    }
  ],
  "shipping": {
    "address_2": "",
    "city": "Tuulos",
    "postcode": "14820",
    "first_name": "Markku",
    "last_name": "Nieminen",
    "state": "",
    "country": "FI",
    "company": "",
    "address_1": "Maaherrantie 23"
  },
  "payment_method": "paytrail",
  "transaction_id": "4120e6dadc",
  "fee_lines": [],
  "coupon_lines": [],
  "refunds": [],
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5916"
      }
    ],
    "customer": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/customers/681"
      }
    ]
  },
  "date_paid_gmt": "2021-10-05T15:54:27",
  "status": "completed",
  "date_completed": "2021-10-08T06:55:26",
  "date_completed_gmt": "2021-10-08T03:55:26",
  "cart_hash": "c469a0a67c88f96b67dd52f554de4b75",
  "meta_data": [
    {
      "key": "is_vat_exempt",
      "value": "no",
      "id": 242042
    },
    {
      "key": "_woo_carrier_agent_id",
      "value": "6371",
      "id": 242043
    },
    {
      "key": "_woo_carrier_agent_meta",
      "value": {
        "title": "Automaatti S-Market Tuulos",
        "distance": "4.1",
        "city": "TUULOS",
        "street_address": "Tuulosentie 1",
        "postcode": "14810",
        "logo_url": "",
        "country": "FI",
        "carrier": "matkahuolto",
        "id": "6371",
        "street_address2": ""
      },
      "id": 242044
    },
    {
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496116FI\";s:6:\"weight\";d:0.1000000000000000055511151231257827021181583404541015625;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}",
      "id": 242097
    }
  ],
  "order_key": "wc_order_iSZ14D3Ak7G15",
  "currency": "EUR",
  "line_items": [
    {
      "taxes": [
        {
          "subtotal": "2.322576",
          "total": "2.322576",
          "id": 1
        }
      ],
      "total": "9.68",
      "sku": "WE_TAHETA",
      "id": 7291,
      "product_id": 968,
      "meta_data": [],
      "name": "Putkenpäähela, harmaa, Ø14mm, 2kpl/pss",
      "variation_id": 0,
      "price": 4.8387,
      "tax_class": "",
      "subtotal": "9.68",
      "total_tax": "2.32",
      "subtotal_tax": "2.32",
      "quantity": 2
    },
    {
      "taxes": [
        {
          "subtotal": "1.16136",
          "total": "1.16136",
          "id": 1
        }
      ],
      "total": "4.84",
      "sku": "WE_RE_VÄHE",
      "id": 7292,
      "product_id": 914,
      "meta_data": [],
      "name": "Välihela, harmaa, 2kpl/pss",
      "variation_id": 0,
      "price": 4.839,
      "tax_class": "",
      "subtotal": "4.84",
      "total_tax": "1.16",
      "subtotal_tax": "1.16",
      "quantity": 1
    }
  ],
  "customer_id": 681,
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "instance_id": "5",
      "total": "6.05",
      "id": 7293,
      "taxes": [
        {
          "subtotal": "",
          "total": "1.452",
          "id": 1
        }
      ],
      "total_tax": "1.45",
      "method_title": "Matkahuolto Lähellä-paketti",
      "meta_data": [
        {
          "key": "Tuotteet",
          "value": "Putkenpäähela, harmaa, Ø14mm, 2kpl/pss &times; 2, Välihela, harmaa, 2kpl/pss &times; 1",
          "id": 53972
        }
      ]
    }
  ],
  "date_created": "2021-10-05T18:52:28",
  "created_via": "checkout",
  "date_created_gmt": "2021-10-05T15:52:28",
  "date_paid": "2021-10-05T18:54:27",
  "date_modified": "2021-10-08T06:55:26",
  "payment_method_title": "Paytrail",
  "date_modified_gmt": "2021-10-08T03:55:26",
  "id": 5916,
  "discount_total": "0.00",
  "discount_tax": "0.00",
  "shipping_total": "6.05",
  "version": "3.6.2",
  "shipping_tax": "1.45",
  "parent_id": 0,
  "cart_tax": "3.48"
}', '', '', 'Nieminen Markku
Maaherrantie 23
14820 Tuulos', '5916', 'AV', 'TI', 'HV', 20.57, '', '20220123.151124.3a001.so_  zzy9f84d896921dcrr', 'K', 4.93)
'
 	23.1.2022 	15:11:25 	_lx_ExecuteSqlNew 	(5. palvelin)

warning: 
*** sql error: 4d execute sql error -1: Error -1, Table 'JSON_DATA' is not declared in the FROM clause. (SQLS 1103)
Failed to validate column 'PRO_FORMA_NUMBER'. (SQLS 1717)
Failed to validate INSERT command. (SQLS 1727)
Table 'JSON_DATA' is not declared in the FROM clause.Failed to validate INSERT command. (SQLS 1103)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, json_data.pro_forma_number, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti S-Market Tuulos
Tuulosentie 1
14810 TUULOS', '7000', 'Nieminen Markku
Maaherrantie 23
14820 Tuulos
0505275803, make62@gmail.com', '7000', '{
  "total": "25.50",
  "total_tax": "4.93",
  "number": "5916",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "customer_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36",
  "customer_note": "",
  "billing": {
    "address_2": "",
    "city": "Tuulos",
    "postcode": "14820",
    "first_name": "Markku",
    "last_name": "Nieminen",
    "state": "",
    "phone": "0505275803",
    "country": "FI",
    "company": "",
    "email": "make62@gmail.com",
    "address_1": "Maaherrantie 23"
  },
  "tax_lines": [
    {
      "rate_code": "FI-ALV.-1",
      "label": "alv.",
      "rate_id": 1,
      "id": 7294,
      "tax_total": "3.48",
      "shipping_tax_total": "1.45",
      "compound": false,
      "meta_data": []
    }
  ],
  "shipping": {
    "address_2": "",
    "city": "Tuulos",
    "postcode": "14820",
    "first_name": "Markku",
    "last_name": "Nieminen",
    "state": "",
    "country": "FI",
    "company": "",
    "address_1": "Maaherrantie 23"
  },
  "payment_method": "paytrail",
  "transaction_id": "4120e6dadc",
  "fee_lines": [],
  "coupon_lines": [],
  "refunds": [],
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5916"
      }
    ],
    "customer": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/customers/681"
      }
    ]
  },
  "date_paid_gmt": "2021-10-05T15:54:27",
  "status": "completed",
  "date_completed": "2021-10-08T06:55:26",
  "date_completed_gmt": "2021-10-08T03:55:26",
  "cart_hash": "c469a0a67c88f96b67dd52f554de4b75",
  "meta_data": [
    {
      "key": "is_vat_exempt",
      "value": "no",
      "id": 242042
    },
    {
      "key": "_woo_carrier_agent_id",
      "value": "6371",
      "id": 242043
    },
    {
      "key": "_woo_carrier_agent_meta",
      "value": {
        "title": "Automaatti S-Market Tuulos",
        "distance": "4.1",
        "city": "TUULOS",
        "street_address": "Tuulosentie 1",
        "postcode": "14810",
        "logo_url": "",
        "country": "FI",
        "carrier": "matkahuolto",
        "id": "6371",
        "street_address2": ""
      },
      "id": 242044
    },
    {
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496116FI\";s:6:\"weight\";d:0.1000000000000000055511151231257827021181583404541015625;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}",
      "id": 242097
    }
  ],
  "order_key": "wc_order_iSZ14D3Ak7G15",
  "currency": "EUR",
  "line_items": [
    {
      "taxes": [
        {
          "subtotal": "2.322576",
          "total": "2.322576",
          "id": 1
        }
      ],
      "total": "9.68",
      "sku": "WE_TAHETA",
      "id": 7291,
      "product_id": 968,
      "meta_data": [],
      "name": "Putkenpäähela, harmaa, Ø14mm, 2kpl/pss",
      "variation_id": 0,
      "price": 4.8387,
      "tax_class": "",
      "subtotal": "9.68",
      "total_tax": "2.32",
      "subtotal_tax": "2.32",
      "quantity": 2
    },
    {
      "taxes": [
        {
          "subtotal": "1.16136",
          "total": "1.16136",
          "id": 1
        }
      ],
      "total": "4.84",
      "sku": "WE_RE_VÄHE",
      "id": 7292,
      "product_id": 914,
      "meta_data": [],
      "name": "Välihela, harmaa, 2kpl/pss",
      "variation_id": 0,
      "price": 4.839,
      "tax_class": "",
      "subtotal": "4.84",
      "total_tax": "1.16",
      "subtotal_tax": "1.16",
      "quantity": 1
    }
  ],
  "customer_id": 681,
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "instance_id": "5",
      "total": "6.05",
      "id": 7293,
      "taxes": [
        {
          "subtotal": "",
          "total": "1.452",
          "id": 1
        }
      ],
      "total_tax": "1.45",
      "method_title": "Matkahuolto Lähellä-paketti",
      "meta_data": [
        {
          "key": "Tuotteet",
          "value": "Putkenpäähela, harmaa, Ø14mm, 2kpl/pss &times; 2, Välihela, harmaa, 2kpl/pss &times; 1",
          "id": 53972
        }
      ]
    }
  ],
  "date_created": "2021-10-05T18:52:28",
  "created_via": "checkout",
  "date_created_gmt": "2021-10-05T15:52:28",
  "date_paid": "2021-10-05T18:54:27",
  "date_modified": "2021-10-08T06:55:26",
  "payment_method_title": "Paytrail",
  "date_modified_gmt": "2021-10-08T03:55:26",
  "id": 5916,
  "discount_total": "0.00",
  "discount_tax": "0.00",
  "shipping_total": "6.05",
  "version": "3.6.2",
  "shipping_tax": "1.45",
  "parent_id": 0,
  "cart_tax": "3.48"
}', '', '', 'Nieminen Markku
Maaherrantie 23
14820 Tuulos', '5916', 'AV', 'TI', 'HV', 20.57, '', '20220123.151124.3a001.so_  zzy9f84d896921dcrr', 'K', 4.93) 
INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, json_data.pro_forma_number, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti S-Market Tuulos
Tuulosentie 1
14810 TUULOS', '7000', 'Nieminen Markku
Maaherrantie 23
14820 Tuulos
0505275803, make62@gmail.com', '7000', '{
  "total": "25.50",
  "total_tax": "4.93",
  "number": "5916",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "customer_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36",
  "customer_note": "",
  "billing": {
    "address_2": "",
    "city": "Tuulos",
    "postcode": "14820",
    "first_name": "Markku",
    "last_name": "Nieminen",
    "state": "",
    "phone": "0505275803",
    "country": "FI",
    "company": "",
    "email": "make62@gmail.com",
    "address_1": "Maaherrantie 23"
  },
  "tax_lines": [
    {
      "rate_code": "FI-ALV.-1",
      "label": "alv.",
      "rate_id": 1,
      "id": 7294,
      "tax_total": "3.48",
      "shipping_tax_total": "1.45",
      "compound": false,
      "meta_data": []
    }
  ],
  "shipping": {
    "address_2": "",
    "city": "Tuulos",
    "postcode": "14820",
    "first_name": "Markku",
    "last_name": "Nieminen",
    "state": "",
    "country": "FI",
    "company": "",
    "address_1": "Maaherrantie 23"
  },
  "payment_method": "paytrail",
  "transaction_id": "4120e6dadc",
  "fee_lines": [],
  "coupon_lines": [],
  "refunds": [],
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5916"
      }
    ],
    "customer": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/customers/681"
      }
    ]
  },
  "date_paid_gmt": "2021-10-05T15:54:27",
  "status": "completed",
  "date_completed": "2021-10-08T06:55:26",
  "date_completed_gmt": "2021-10-08T03:55:26",
  "cart_hash": "c469a0a67c88f96b67dd52f554de4b75",
  "meta_data": [
    {
      "key": "is_vat_exempt",
      "value": "no",
      "id": 242042
    },
    {
      "key": "_woo_carrier_agent_id",
      "value": "6371",
      "id": 242043
    },
    {
      "key": "_woo_carrier_agent_meta",
      "value": {
        "title": "Automaatti S-Market Tuulos",
        "distance": "4.1",
        "city": "TUULOS",
        "street_address": "Tuulosentie 1",
        "postcode": "14810",
        "logo_url": "",
        "country": "FI",
        "carrier": "matkahuolto",
        "id": "6371",
        "street_address2": ""
      },
      "id": 242044
    },
    {
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496116FI\";s:6:\"weight\";d:0.1000000000000000055511151231257827021181583404541015625;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}",
      "id": 242097
    }
  ],
  "order_key": "wc_order_iSZ14D3Ak7G15",
  "currency": "EUR",
  "line_items": [
    {
      "taxes": [
        {
          "subtotal": "2.322576",
          "total": "2.322576",
          "id": 1
        }
      ],
      "total": "9.68",
      "sku": "WE_TAHETA",
      "id": 7291,
      "product_id": 968,
      "meta_data": [],
      "name": "Putkenpäähela, harmaa, Ø14mm, 2kpl/pss",
      "variation_id": 0,
      "price": 4.8387,
      "tax_class": "",
      "subtotal": "9.68",
      "total_tax": "2.32",
      "subtotal_tax": "2.32",
      "quantity": 2
    },
    {
      "taxes": [
        {
          "subtotal": "1.16136",
          "total": "1.16136",
          "id": 1
        }
      ],
      "total": "4.84",
      "sku": "WE_RE_VÄHE",
      "id": 7292,
      "product_id": 914,
      "meta_data": [],
      "name": "Välihela, harmaa, 2kpl/pss",
      "variation_id": 0,
      "price": 4.839,
      "tax_class": "",
      "subtotal": "4.84",
      "total_tax": "1.16",
      "subtotal_tax": "1.16",
      "quantity": 1
    }
  ],
  "customer_id": 681,
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "instance_id": "5",
      "total": "6.05",
      "id": 7293,
      "taxes": [
        {
          "subtotal": "",
          "total": "1.452",
          "id": 1
        }
      ],
      "total_tax": "1.45",
      "method_title": "Matkahuolto Lähellä-paketti",
      "meta_data": [
        {
          "key": "Tuotteet",
          "value": "Putkenpäähela, harmaa, Ø14mm, 2kpl/pss &times; 2, Välihela, harmaa, 2kpl/pss &times; 1",
          "id": 53972
        }
      ]
    }
  ],
  "date_created": "2021-10-05T18:52:28",
  "created_via": "checkout",
  "date_created_gmt": "2021-10-05T15:52:28",
  "date_paid": "2021-10-05T18:54:27",
  "date_modified": "2021-10-08T06:55:26",
  "payment_method_title": "Paytrail",
  "date_modified_gmt": "2021-10-08T03:55:26",
  "id": 5916,
  "discount_total": "0.00",
  "discount_tax": "0.00",
  "shipping_total": "6.05",
  "version": "3.6.2",
  "shipping_tax": "1.45",
  "parent_id": 0,
  "cart_tax": "3.48"
}', '', '', 'Nieminen Markku
Maaherrantie 23
14820 Tuulos', '5916', 'AV', 'TI', 'HV', 20.57, '', '20220123.151124.3a001.so_  zzy9f84d896921dcrr', 'K', 4.93)


. 	23.1.2022 	15:11:25 	lx 	(5. palvelin)

4d execute sql error -1: Error -1, Table 'JSON_DATA' is not declared in the FROM clause. (SQLS 1103)
Failed to validate column 'PRO_FORMA_NUMBER'. (SQLS 1717)
Failed to validate INSERT command. (SQLS 1727)
Table 'JSON_DATA' is not declared in the FROM clause.Failed to validate INSERT command. (SQLS 1103)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, json_data.pro_forma_number, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti S-Market Tuulos
Tuulosentie 1
14810 TUULOS', '7000', 'Nieminen Markku
Maaherrantie 23
14820 Tuulos
0505275803, make62@gmail.com', '7000', '{
  "total": "25.50",
  "total_tax": "4.93",
  "number": "5916",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "customer_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36",
  "customer_note": "",
  "billing": {
    "address_2": "",
    "city": "Tuulos",
    "postcode": "14820",
    "first_name": "Markku",
    "last_name": "Nieminen",
    "state": "",
    "phone": "0505275803",
    "country": "FI",
    "company": "",
    "email": "make62@gmail.com",
    "address_1": "Maaherrantie 23"
  },
  "tax_lines": [
    {
      "rate_code": "FI-ALV.-1",
      "label": "alv.",
      "rate_id": 1,
      "id": 7294,
      "tax_total": "3.48",
      "shipping_tax_total": "1.45",
      "compound": false,
      "meta_data": []
    }
  ],
  "shipping": {
    "address_2": "",
    "city": "Tuulos",
    "postcode": "14820",
    "first_name": "Markku",
    "last_name": "Nieminen",
    "state": "",
    "country": "FI",
    "company": "",
    "address_1": "Maaherrantie 23"
  },
  "payment_method": "paytrail",
  "transaction_id": "4120e6dadc",
  "fee_lines": [],
  "coupon_lines": [],
  "refunds": [],
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5916"
      }
    ],
    "customer": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/customers/681"
      }
    ]
  },
  "date_paid_gmt": "2021-10-05T15:54:27",
  "status": "completed",
  "date_completed": "2021-10-08T06:55:26",
  "date_completed_gmt": "2021-10-08T03:55:26",
  "cart_hash": "c469a0a67c88f96b67dd52f554de4b75",
  "meta_data": [
    {
      "key": "is_vat_exempt",
      "value": "no",
      "id": 242042
    },
    {
      "key": "_woo_carrier_agent_id",
      "value": "6371",
      "id": 242043
    },
    {
      "key": "_woo_carrier_agent_meta",
      "value": {
        "title": "Automaatti S-Market Tuulos",
        "distance": "4.1",
        "city": "TUULOS",
        "street_address": "Tuulosentie 1",
        "postcode": "14810",
        "logo_url": "",
        "country": "FI",
        "carrier": "matkahuolto",
        "id": "6371",
        "street_address2": ""
      },
      "id": 242044
    },
    {
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496116FI\";s:6:\"weight\";d:0.1000000000000000055511151231257827021181583404541015625;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}",
      "id": 242097
    }
  ],
  "order_key": "wc_order_iSZ14D3Ak7G15",
  "currency": "EUR",
  "line_items": [
    {
      "taxes": [
        {
          "subtotal": "2.322576",
          "total": "2.322576",
          "id": 1
        }
      ],
      "total": "9.68",
      "sku": "WE_TAHETA",
      "id": 7291,
      "product_id": 968,
      "meta_data": [],
      "name": "Putkenpäähela, harmaa, Ø14mm, 2kpl/pss",
      "variation_id": 0,
      "price": 4.8387,
      "tax_class": "",
      "subtotal": "9.68",
      "total_tax": "2.32",
      "subtotal_tax": "2.32",
      "quantity": 2
    },
    {
      "taxes": [
        {
          "subtotal": "1.16136",
          "total": "1.16136",
          "id": 1
        }
      ],
      "total": "4.84",
      "sku": "WE_RE_VÄHE",
      "id": 7292,
      "product_id": 914,
      "meta_data": [],
      "name": "Välihela, harmaa, 2kpl/pss",
      "variation_id": 0,
      "price": 4.839,
      "tax_class": "",
      "subtotal": "4.84",
      "total_tax": "1.16",
      "subtotal_tax": "1.16",
      "quantity": 1
    }
  ],
  "customer_id": 681,
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "instance_id": "5",
      "total": "6.05",
      "id": 7293,
      "taxes": [
        {
          "subtotal": "",
          "total": "1.452",
          "id": 1
        }
      ],
      "total_tax": "1.45",
      "method_title": "Matkahuolto Lähellä-paketti",
      "meta_data": [
        {
          "key": "Tuotteet",
          "value": "Putkenpäähela, harmaa, Ø14mm, 2kpl/pss &times; 2, Välihela, harmaa, 2kpl/pss &times; 1",
          "id": 53972
        }
      ]
    }
  ],
  "date_created": "2021-10-05T18:52:28",
  "created_via": "checkout",
  "date_created_gmt": "2021-10-05T15:52:28",
  "date_paid": "2021-10-05T18:54:27",
  "date_modified": "2021-10-08T06:55:26",
  "payment_method_title": "Paytrail",
  "date_modified_gmt": "2021-10-08T03:55:26",
  "id": 5916,
  "discount_total": "0.00",
  "discount_tax": "0.00",
  "shipping_total": "6.05",
  "version": "3.6.2",
  "shipping_tax": "1.45",
  "parent_id": 0,
  "cart_tax": "3.48"
}', '', '', 'Nieminen Markku
Maaherrantie 23
14820 Tuulos', '5916', 'AV', 'TI', 'HV', 20.57, '', '20220123.151124.3a001.so_  zzy9f84d896921dcrr', 'K', 4.93). 	23.1.2022 	15:11:25 	_lx_SERVER 	(5. palvelin)

4D: SELECT so.record_id FROM sales_order so WHERE so.project_id <> '' LIMIT 500 INTO :_lx_atExe1
 - original query: SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id FROM sales_order so  WHERE so.project_id <> ''  ORDER BY so.sales_order_id DESC  LIMIT 500  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8
 - result _lx_atExe1 size: 500, first value: '2001066'
 - query name: new:form/nc/erp-sync/woocommerce/query-local/order-sales.json. 	23.1.2022 	15:11:25 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 5, send result: -1, send count: 4, loop count: 4, bytes sent 326640 / 342010, 15370 remaining, total send time 4 µs. 	23.1.2022 	15:11:25 	lx 	(5. palvelin)

 -- tcp answer 5, send count: 5, loop count: 5, bytes sent 342010 / 342010, 0 remaining, total send time 1257 µs. 	23.1.2022 	15:11:26 	lx 	(5. palvelin)

4D: SELECT inv.record_id FROM invoice inv WHERE inv.invoice_id <> '' INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv  WHERE inv.invoice_id <> ''  ORDER BY inv.invoice_id  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
 - result _lx_atExe1 size: 53111, first value: '1'
 - query name: new:form/nc/erp-sync/query/order-invoice.json. 	23.1.2022 	15:13:53 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 6, send result: -1, send count: 8, loop count: 8, bytes sent 587952 / 2809407, 2221455 remaining, total send time 59 µs. 	23.1.2022 	15:13:56 	lx 	(5. palvelin)

 -- tcp answer 6, send result: -1, send count: 9, loop count: 10, bytes sent 669612 / 2809407, 2139795 remaining, total send time 1307 µs. 	23.1.2022 	15:13:56 	lx 	(5. palvelin)

 -- tcp answer 6, send result: -1, send count: 16, loop count: 19, bytes sent 1175904 / 2809407, 1633503 remaining, total send time 3901 µs. 	23.1.2022 	15:13:56 	lx 	(5. palvelin)

 -- tcp answer 6, send result: -1, send count: 17, loop count: 21, bytes sent 1257564 / 2809407, 1551843 remaining, total send time 5429 µs. 	23.1.2022 	15:13:56 	lx 	(5. palvelin)

error:  -- tcp answer 6, remaining bytes send failed with result code: -100, bytes sent: 1339224 / 2809407, total send time 6716 µs
  [stack traceback:
	/Users/pasi/nc/nc-server/lib/util.lua:546: in function 'printError'
	/Users/pasi/nc/nc-server/lib/lib_tcp.lua:318: in function 'send'
	/Users/pasi/nc/nc-server/lib/server.lua:141: in function 'answer'
	/Users/pasi/nc/nc-server/lib/server.lua:225: in function 'in_callback'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:248: in function 'poll_event'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:329: in function 'poll'
	/Users/pasi/nc/nc-server/lib/server.lua:312: in function 'pollLoop'
	/Users/pasi/nc/nc-server/nc/nc-server.lua:123: in function 'server'
	/Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:146: in function </Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:129>
	[C]: in function 'pcall'
	/Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:66: in function </Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:18>]
. 	23.1.2022 	15:13:56 	lx 	(5. palvelin)

error:  -- tcp answer 6, remaining bytes send failed with result code: -100, bytes sent: 1339224 / 2809407, total send time 6716 µs
  [stack traceback:
	/Users/pasi/nc/nc-server/lib/util.lua:546: in function 'printError'
	/Users/pasi/nc/nc-server/lib/lib_tcp.lua:318: in function 'send'
	/Users/pasi/nc/nc-server/lib/server.lua:141: in function 'answer'
	/Users/pasi/nc/nc-server/lib/server.lua:225: in function 'in_callback'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:248: in function 'poll_event'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:329: in function 'poll'
	/Users/pasi/nc/nc-server/lib/server.lua:312: in function 'pollLoop'
	/Users/pasi/nc/nc-server/nc/nc-server.lua:123: in function 'server'
	/Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:146: in function </Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:129>
	[C]: in function 'pcall'
	/Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:66: in function </Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:18>]. 	23.1.2022 	15:13:56 	_lx_SERVER 	(5. palvelin)

*** tcp close for sock 77, type 'nil', protocol 'HTTP', reason: 'POLLHUP', request length: 1 174 bytes ***. 	23.1.2022 	15:14:55 	lx 	(5. palvelin)

closing socket '77'. 	23.1.2022 	15:14:55 	lx 	(5. palvelin)

4D: SELECT _prf.record_id FROM _preference _prf WHERE name_id = '_code_SiteCode' INTO :_lx_atExe1
 - original query: SELECT text_value FROM _preference WHERE name_id = '_code_SiteCode'  INTO :_lx_atExe1
 - result _lx_atExe1 size: 1, first value: 'ZZY0'
 - query name: new:dsql.sqlExecuteUnsafe. 	23.1.2022 	15:15:19 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT _prf.record_id FROM _preference _prf WHERE name_id = 'code_default.json' INTO :_lx_atExe1
 - original query: SELECT text_value FROM _preference WHERE name_id = 'code_default.json'  INTO :_lx_atExe1
 - result _lx_atExe1 size: 1, first value: '{
  "code": {
    "_CODE_ALFLD": [4002, 4002, 4002, 4013, 4013, 4013, 8011, 8011, 10004, 11005, 17004, 17004, 17004, 17004, 17004, 17004, 21001, 21001, 21001, 21001, 21001, 21001, 26002, 27001, 28008, 28008, 29001, 29001, 31001, 31001, 31011, 32002, 32002, 33001, 37001, 37001, 42001, 43002, 44012, 44031, 44031, 44032, 48036, 50001, 54001],
    "_CODE_ASFLDNAME": ["[Tosite]TUNNUS", "[Tosite]Tosite ID", "[Tosite]TUNNUS", "[Tosite]Tositenumero", "[Tosite]Tositenumero", "[Tosite]Tositenumero", "[Var'
 - query name: new:dsql.sqlExecuteUnsafe. 	23.1.2022 	15:15:19 	_lx_ExecuteSqlNew 	(5. palvelin)

sql: Error -1, Table 'JSON_DATA' is not declared in the FROM clause. (SQLS 1103)
Failed to validate column 'PRO_FORMA_NUMBER'. (SQLS 1717)
Failed to validate INSERT command. (SQLS 1727)
Table 'JSON_DATA' is not declared in the FROM clause.Failed to validate INSERT command. (SQLS 1103)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, json_data.pro_forma_number, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "date_paid": "2021-10-04T16:09:38",
  "date_modified_gmt": "2021-10-08T04:01:57",
  "_links": {
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ],
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ]
  },
  "discount_tax": "0.00",
  "shipping_total": "6.05",
  "payment_method_title": "Paytrail",
  "date_paid_gmt": "2021-10-04T13:09:38",
  "created_via": "checkout",
  "date_completed": "2021-10-08T07:01:57",
  "date_completed_gmt": "2021-10-08T04:01:57",
  "customer_id": 0,
  "currency": "EUR",
  "total_tax": "3.97",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "line_items": [
    {
      "product_id": 2149,
      "meta_data": [],
      "taxes": [
        {
          "subtotal": "2.5152",
          "id": 1,
          "total": "2.5152"
        }
      ],
      "price": 10.48,
      "name": "Serafil 20 Beige 0267 WR",
      "sku": "RE_LASERA20B0267",
      "total": "10.48",
      "variation_id": 0,
      "id": 7280,
      "tax_class": "",
      "subtotal_tax": "2.52",
      "total_tax": "2.52",
      "subtotal": "10.48",
      "quantity": 1
    }
  ],
  "billing": {
    "email": "orau@windowslive.com",
    "address_2": "",
    "city": "Nummela",
    "postcode": "04109",
    "country": "FI",
    "address_1": "Hopeasepäntie 9 as 3",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "company": "",
    "phone": "0407460885",
    "state": ""
  },
  "cart_tax": "2.52",
  "parent_id": 0,
  "shipping_tax": "1.45",
  "discount_total": "0.00",
  "id": 5911,
  "customer_note": "",
  "refunds": [],
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "instance_id": "5",
      "id": 7281,
      "taxes": [
        {
          "subtotal": "",
          "id": 1,
          "total": "1.452"
        }
      ],
      "method_title": "Matkahuolto Lähellä-paketti",
      "meta_data": [
        {
          "value": "Serafil 20 Beige 0267 WR &times; 1",
          "id": 53885,
          "key": "Tuotteet"
        }
      ],
      "total_tax": "1.45",
      "total": "6.05"
    }
  ],
  "tax_lines": [
    {
      "compound": false,
      "meta_data": [],
      "id": 7282,
      "rate_code": "FI-ALV.-1",
      "tax_total": "2.52",
      "rate_id": 1,
      "shipping_tax_total": "1.45",
      "label": "alv."
    }
  ],
  "meta_data": [
    {
      "value": "no",
      "id": 241915,
      "key": "is_vat_exempt"
    },
    {
      "value": "6277",
      "id": 242117,
      "key": "_woo_carrier_agent_id"
    },
    {
      "value": {
        "city": "Nummela",
        "street_address": "Tuusankaari 1",
        "postcode": "03100",
        "country": "FI",
        "carrier": "matkahuolto",
        "street_address2": "",
        "title": "Automaatti K-Citymarket Nummela",
        "id": "6277",
        "distance": "0.1",
        "logo_url": ""
      },
      "id": 242119,
      "key": "_woo_carrier_agent_meta"
    },
    {
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}",
      "id": 242120,
      "key": "_wc_matkahuolto"
    }
  ],
  "coupon_lines": [],
  "status": "completed",
  "shipping": {
    "address_2": "",
    "company": "",
    "postcode": "04109",
    "country": "FI",
    "first_name": "Olli",
    "state": "",
    "last_name": "Rautiainen",
    "address_1": "Hopeasepäntie 9 as 3",
    "city": "Nummela"
  },
  "transaction_id": "b9b5739bc0",
  "total": "20.50",
  "order_key": "wc_order_5u5kiQdAERF01",
  "date_created": "2021-10-04T16:08:10",
  "version": "3.6.2",
  "fee_lines": [],
  "date_created_gmt": "2021-10-04T13:08:10",
  "payment_method": "paytrail",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "number": "5911",
  "date_modified": "2021-10-08T07:01:57"
}', '', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.151519.ko001.so_  zzy9f84d896921dcrr', 'K', 3.97)
'
INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, json_data.pro_forma_number, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "date_paid": "2021-10-04T16:09:38",
  "date_modified_gmt": "2021-10-08T04:01:57",
  "_links": {
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ],
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ]
  },
  "discount_tax": "0.00",
  "shipping_total": "6.05",
  "payment_method_title": "Paytrail",
  "date_paid_gmt": "2021-10-04T13:09:38",
  "created_via": "checkout",
  "date_completed": "2021-10-08T07:01:57",
  "date_completed_gmt": "2021-10-08T04:01:57",
  "customer_id": 0,
  "currency": "EUR",
  "total_tax": "3.97",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "line_items": [
    {
      "product_id": 2149,
      "meta_data": [],
      "taxes": [
        {
          "subtotal": "2.5152",
          "id": 1,
          "total": "2.5152"
        }
      ],
      "price": 10.48,
      "name": "Serafil 20 Beige 0267 WR",
      "sku": "RE_LASERA20B0267",
      "total": "10.48",
      "variation_id": 0,
      "id": 7280,
      "tax_class": "",
      "subtotal_tax": "2.52",
      "total_tax": "2.52",
      "subtotal": "10.48",
      "quantity": 1
    }
  ],
  "billing": {
    "email": "orau@windowslive.com",
    "address_2": "",
    "city": "Nummela",
    "postcode": "04109",
    "country": "FI",
    "address_1": "Hopeasepäntie 9 as 3",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "company": "",
    "phone": "0407460885",
    "state": ""
  },
  "cart_tax": "2.52",
  "parent_id": 0,
  "shipping_tax": "1.45",
  "discount_total": "0.00",
  "id": 5911,
  "customer_note": "",
  "refunds": [],
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "instance_id": "5",
      "id": 7281,
      "taxes": [
        {
          "subtotal": "",
          "id": 1,
          "total": "1.452"
        }
      ],
      "method_title": "Matkahuolto Lähellä-paketti",
      "meta_data": [
        {
          "value": "Serafil 20 Beige 0267 WR &times; 1",
          "id": 53885,
          "key": "Tuotteet"
        }
      ],
      "total_tax": "1.45",
      "total": "6.05"
    }
  ],
  "tax_lines": [
    {
      "compound": false,
      "meta_data": [],
      "id": 7282,
      "rate_code": "FI-ALV.-1",
      "tax_total": "2.52",
      "rate_id": 1,
      "shipping_tax_total": "1.45",
      "label": "alv."
    }
  ],
  "meta_data": [
    {
      "value": "no",
      "id": 241915,
      "key": "is_vat_exempt"
    },
    {
      "value": "6277",
      "id": 242117,
      "key": "_woo_carrier_agent_id"
    },
    {
      "value": {
        "city": "Nummela",
        "street_address": "Tuusankaari 1",
        "postcode": "03100",
        "country": "FI",
        "carrier": "matkahuolto",
        "street_address2": "",
        "title": "Automaatti K-Citymarket Nummela",
        "id": "6277",
        "distance": "0.1",
        "logo_url": ""
      },
      "id": 242119,
      "key": "_woo_carrier_agent_meta"
    },
    {
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}",
      "id": 242120,
      "key": "_wc_matkahuolto"
    }
  ],
  "coupon_lines": [],
  "status": "completed",
  "shipping": {
    "address_2": "",
    "company": "",
    "postcode": "04109",
    "country": "FI",
    "first_name": "Olli",
    "state": "",
    "last_name": "Rautiainen",
    "address_1": "Hopeasepäntie 9 as 3",
    "city": "Nummela"
  },
  "transaction_id": "b9b5739bc0",
  "total": "20.50",
  "order_key": "wc_order_5u5kiQdAERF01",
  "date_created": "2021-10-04T16:08:10",
  "version": "3.6.2",
  "fee_lines": [],
  "date_created_gmt": "2021-10-04T13:08:10",
  "payment_method": "paytrail",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "number": "5911",
  "date_modified": "2021-10-08T07:01:57"
}', '', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.151519.ko001.so_  zzy9f84d896921dcrr', 'K', 3.97)
'
 	23.1.2022 	15:15:19 	_lx_ExecuteSqlNew 	(5. palvelin)

warning: 
*** sql error: 4d execute sql error -1: Error -1, Table 'JSON_DATA' is not declared in the FROM clause. (SQLS 1103)
Failed to validate column 'PRO_FORMA_NUMBER'. (SQLS 1717)
Failed to validate INSERT command. (SQLS 1727)
Table 'JSON_DATA' is not declared in the FROM clause.Failed to validate INSERT command. (SQLS 1103)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, json_data.pro_forma_number, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "date_paid": "2021-10-04T16:09:38",
  "date_modified_gmt": "2021-10-08T04:01:57",
  "_links": {
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ],
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ]
  },
  "discount_tax": "0.00",
  "shipping_total": "6.05",
  "payment_method_title": "Paytrail",
  "date_paid_gmt": "2021-10-04T13:09:38",
  "created_via": "checkout",
  "date_completed": "2021-10-08T07:01:57",
  "date_completed_gmt": "2021-10-08T04:01:57",
  "customer_id": 0,
  "currency": "EUR",
  "total_tax": "3.97",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "line_items": [
    {
      "product_id": 2149,
      "meta_data": [],
      "taxes": [
        {
          "subtotal": "2.5152",
          "id": 1,
          "total": "2.5152"
        }
      ],
      "price": 10.48,
      "name": "Serafil 20 Beige 0267 WR",
      "sku": "RE_LASERA20B0267",
      "total": "10.48",
      "variation_id": 0,
      "id": 7280,
      "tax_class": "",
      "subtotal_tax": "2.52",
      "total_tax": "2.52",
      "subtotal": "10.48",
      "quantity": 1
    }
  ],
  "billing": {
    "email": "orau@windowslive.com",
    "address_2": "",
    "city": "Nummela",
    "postcode": "04109",
    "country": "FI",
    "address_1": "Hopeasepäntie 9 as 3",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "company": "",
    "phone": "0407460885",
    "state": ""
  },
  "cart_tax": "2.52",
  "parent_id": 0,
  "shipping_tax": "1.45",
  "discount_total": "0.00",
  "id": 5911,
  "customer_note": "",
  "refunds": [],
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "instance_id": "5",
      "id": 7281,
      "taxes": [
        {
          "subtotal": "",
          "id": 1,
          "total": "1.452"
        }
      ],
      "method_title": "Matkahuolto Lähellä-paketti",
      "meta_data": [
        {
          "value": "Serafil 20 Beige 0267 WR &times; 1",
          "id": 53885,
          "key": "Tuotteet"
        }
      ],
      "total_tax": "1.45",
      "total": "6.05"
    }
  ],
  "tax_lines": [
    {
      "compound": false,
      "meta_data": [],
      "id": 7282,
      "rate_code": "FI-ALV.-1",
      "tax_total": "2.52",
      "rate_id": 1,
      "shipping_tax_total": "1.45",
      "label": "alv."
    }
  ],
  "meta_data": [
    {
      "value": "no",
      "id": 241915,
      "key": "is_vat_exempt"
    },
    {
      "value": "6277",
      "id": 242117,
      "key": "_woo_carrier_agent_id"
    },
    {
      "value": {
        "city": "Nummela",
        "street_address": "Tuusankaari 1",
        "postcode": "03100",
        "country": "FI",
        "carrier": "matkahuolto",
        "street_address2": "",
        "title": "Automaatti K-Citymarket Nummela",
        "id": "6277",
        "distance": "0.1",
        "logo_url": ""
      },
      "id": 242119,
      "key": "_woo_carrier_agent_meta"
    },
    {
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}",
      "id": 242120,
      "key": "_wc_matkahuolto"
    }
  ],
  "coupon_lines": [],
  "status": "completed",
  "shipping": {
    "address_2": "",
    "company": "",
    "postcode": "04109",
    "country": "FI",
    "first_name": "Olli",
    "state": "",
    "last_name": "Rautiainen",
    "address_1": "Hopeasepäntie 9 as 3",
    "city": "Nummela"
  },
  "transaction_id": "b9b5739bc0",
  "total": "20.50",
  "order_key": "wc_order_5u5kiQdAERF01",
  "date_created": "2021-10-04T16:08:10",
  "version": "3.6.2",
  "fee_lines": [],
  "date_created_gmt": "2021-10-04T13:08:10",
  "payment_method": "paytrail",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "number": "5911",
  "date_modified": "2021-10-08T07:01:57"
}', '', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.151519.ko001.so_  zzy9f84d896921dcrr', 'K', 3.97) 
INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, json_data.pro_forma_number, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "date_paid": "2021-10-04T16:09:38",
  "date_modified_gmt": "2021-10-08T04:01:57",
  "_links": {
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ],
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ]
  },
  "discount_tax": "0.00",
  "shipping_total": "6.05",
  "payment_method_title": "Paytrail",
  "date_paid_gmt": "2021-10-04T13:09:38",
  "created_via": "checkout",
  "date_completed": "2021-10-08T07:01:57",
  "date_completed_gmt": "2021-10-08T04:01:57",
  "customer_id": 0,
  "currency": "EUR",
  "total_tax": "3.97",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "line_items": [
    {
      "product_id": 2149,
      "meta_data": [],
      "taxes": [
        {
          "subtotal": "2.5152",
          "id": 1,
          "total": "2.5152"
        }
      ],
      "price": 10.48,
      "name": "Serafil 20 Beige 0267 WR",
      "sku": "RE_LASERA20B0267",
      "total": "10.48",
      "variation_id": 0,
      "id": 7280,
      "tax_class": "",
      "subtotal_tax": "2.52",
      "total_tax": "2.52",
      "subtotal": "10.48",
      "quantity": 1
    }
  ],
  "billing": {
    "email": "orau@windowslive.com",
    "address_2": "",
    "city": "Nummela",
    "postcode": "04109",
    "country": "FI",
    "address_1": "Hopeasepäntie 9 as 3",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "company": "",
    "phone": "0407460885",
    "state": ""
  },
  "cart_tax": "2.52",
  "parent_id": 0,
  "shipping_tax": "1.45",
  "discount_total": "0.00",
  "id": 5911,
  "customer_note": "",
  "refunds": [],
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "instance_id": "5",
      "id": 7281,
      "taxes": [
        {
          "subtotal": "",
          "id": 1,
          "total": "1.452"
        }
      ],
      "method_title": "Matkahuolto Lähellä-paketti",
      "meta_data": [
        {
          "value": "Serafil 20 Beige 0267 WR &times; 1",
          "id": 53885,
          "key": "Tuotteet"
        }
      ],
      "total_tax": "1.45",
      "total": "6.05"
    }
  ],
  "tax_lines": [
    {
      "compound": false,
      "meta_data": [],
      "id": 7282,
      "rate_code": "FI-ALV.-1",
      "tax_total": "2.52",
      "rate_id": 1,
      "shipping_tax_total": "1.45",
      "label": "alv."
    }
  ],
  "meta_data": [
    {
      "value": "no",
      "id": 241915,
      "key": "is_vat_exempt"
    },
    {
      "value": "6277",
      "id": 242117,
      "key": "_woo_carrier_agent_id"
    },
    {
      "value": {
        "city": "Nummela",
        "street_address": "Tuusankaari 1",
        "postcode": "03100",
        "country": "FI",
        "carrier": "matkahuolto",
        "street_address2": "",
        "title": "Automaatti K-Citymarket Nummela",
        "id": "6277",
        "distance": "0.1",
        "logo_url": ""
      },
      "id": 242119,
      "key": "_woo_carrier_agent_meta"
    },
    {
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}",
      "id": 242120,
      "key": "_wc_matkahuolto"
    }
  ],
  "coupon_lines": [],
  "status": "completed",
  "shipping": {
    "address_2": "",
    "company": "",
    "postcode": "04109",
    "country": "FI",
    "first_name": "Olli",
    "state": "",
    "last_name": "Rautiainen",
    "address_1": "Hopeasepäntie 9 as 3",
    "city": "Nummela"
  },
  "transaction_id": "b9b5739bc0",
  "total": "20.50",
  "order_key": "wc_order_5u5kiQdAERF01",
  "date_created": "2021-10-04T16:08:10",
  "version": "3.6.2",
  "fee_lines": [],
  "date_created_gmt": "2021-10-04T13:08:10",
  "payment_method": "paytrail",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "number": "5911",
  "date_modified": "2021-10-08T07:01:57"
}', '', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.151519.ko001.so_  zzy9f84d896921dcrr', 'K', 3.97)


. 	23.1.2022 	15:15:19 	lx 	(5. palvelin)

4d execute sql error -1: Error -1, Table 'JSON_DATA' is not declared in the FROM clause. (SQLS 1103)
Failed to validate column 'PRO_FORMA_NUMBER'. (SQLS 1717)
Failed to validate INSERT command. (SQLS 1727)
Table 'JSON_DATA' is not declared in the FROM clause.Failed to validate INSERT command. (SQLS 1103)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, json_data.pro_forma_number, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "date_paid": "2021-10-04T16:09:38",
  "date_modified_gmt": "2021-10-08T04:01:57",
  "_links": {
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ],
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ]
  },
  "discount_tax": "0.00",
  "shipping_total": "6.05",
  "payment_method_title": "Paytrail",
  "date_paid_gmt": "2021-10-04T13:09:38",
  "created_via": "checkout",
  "date_completed": "2021-10-08T07:01:57",
  "date_completed_gmt": "2021-10-08T04:01:57",
  "customer_id": 0,
  "currency": "EUR",
  "total_tax": "3.97",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "line_items": [
    {
      "product_id": 2149,
      "meta_data": [],
      "taxes": [
        {
          "subtotal": "2.5152",
          "id": 1,
          "total": "2.5152"
        }
      ],
      "price": 10.48,
      "name": "Serafil 20 Beige 0267 WR",
      "sku": "RE_LASERA20B0267",
      "total": "10.48",
      "variation_id": 0,
      "id": 7280,
      "tax_class": "",
      "subtotal_tax": "2.52",
      "total_tax": "2.52",
      "subtotal": "10.48",
      "quantity": 1
    }
  ],
  "billing": {
    "email": "orau@windowslive.com",
    "address_2": "",
    "city": "Nummela",
    "postcode": "04109",
    "country": "FI",
    "address_1": "Hopeasepäntie 9 as 3",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "company": "",
    "phone": "0407460885",
    "state": ""
  },
  "cart_tax": "2.52",
  "parent_id": 0,
  "shipping_tax": "1.45",
  "discount_total": "0.00",
  "id": 5911,
  "customer_note": "",
  "refunds": [],
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "instance_id": "5",
      "id": 7281,
      "taxes": [
        {
          "subtotal": "",
          "id": 1,
          "total": "1.452"
        }
      ],
      "method_title": "Matkahuolto Lähellä-paketti",
      "meta_data": [
        {
          "value": "Serafil 20 Beige 0267 WR &times; 1",
          "id": 53885,
          "key": "Tuotteet"
        }
      ],
      "total_tax": "1.45",
      "total": "6.05"
    }
  ],
  "tax_lines": [
    {
      "compound": false,
      "meta_data": [],
      "id": 7282,
      "rate_code": "FI-ALV.-1",
      "tax_total": "2.52",
      "rate_id": 1,
      "shipping_tax_total": "1.45",
      "label": "alv."
    }
  ],
  "meta_data": [
    {
      "value": "no",
      "id": 241915,
      "key": "is_vat_exempt"
    },
    {
      "value": "6277",
      "id": 242117,
      "key": "_woo_carrier_agent_id"
    },
    {
      "value": {
        "city": "Nummela",
        "street_address": "Tuusankaari 1",
        "postcode": "03100",
        "country": "FI",
        "carrier": "matkahuolto",
        "street_address2": "",
        "title": "Automaatti K-Citymarket Nummela",
        "id": "6277",
        "distance": "0.1",
        "logo_url": ""
      },
      "id": 242119,
      "key": "_woo_carrier_agent_meta"
    },
    {
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}",
      "id": 242120,
      "key": "_wc_matkahuolto"
    }
  ],
  "coupon_lines": [],
  "status": "completed",
  "shipping": {
    "address_2": "",
    "company": "",
    "postcode": "04109",
    "country": "FI",
    "first_name": "Olli",
    "state": "",
    "last_name": "Rautiainen",
    "address_1": "Hopeasepäntie 9 as 3",
    "city": "Nummela"
  },
  "transaction_id": "b9b5739bc0",
  "total": "20.50",
  "order_key": "wc_order_5u5kiQdAERF01",
  "date_created": "2021-10-04T16:08:10",
  "version": "3.6.2",
  "fee_lines": [],
  "date_created_gmt": "2021-10-04T13:08:10",
  "payment_method": "paytrail",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "number": "5911",
  "date_modified": "2021-10-08T07:01:57"
}', '', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.151519.ko001.so_  zzy9f84d896921dcrr', 'K', 3.97). 	23.1.2022 	15:15:19 	_lx_SERVER 	(5. palvelin)

4D: SELECT so.record_id FROM sales_order so WHERE so.project_id <> '' LIMIT 500 INTO :_lx_atExe1
 - original query: SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id FROM sales_order so  WHERE so.project_id <> ''  ORDER BY so.sales_order_id DESC  LIMIT 500  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8
 - result _lx_atExe1 size: 500, first value: '2001066'
 - query name: new:form/nc/erp-sync/woocommerce/query-local/order-sales.json. 	23.1.2022 	15:15:20 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 10, send result: -1, send count: 3, loop count: 3, bytes sent 244980 / 342009, 97029 remaining, total send time 3 µs. 	23.1.2022 	15:15:21 	lx 	(5. palvelin)

 -- tcp answer 10, send result: -1, send count: 4, loop count: 5, bytes sent 326640 / 342009, 15369 remaining, total send time 1250 µs. 	23.1.2022 	15:15:21 	lx 	(5. palvelin)

 -- tcp answer 10, send count: 5, loop count: 6, bytes sent 342009 / 342009, 0 remaining, total send time 2481 µs. 	23.1.2022 	15:15:21 	lx 	(5. palvelin)

sql: Error -1, Table 'JSON_DATA' is not declared in the FROM clause. (SQLS 1103)
Failed to validate column 'PRO_FORMA_NUMBER'. (SQLS 1717)
Failed to validate INSERT command. (SQLS 1727)
Table 'JSON_DATA' is not declared in the FROM clause.Failed to validate INSERT command. (SQLS 1103)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, json_data.pro_forma_number, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', '', '7000', 'Suoknuuti Pekka
Kompassikuja 5 A18
48310 KOTKA
040 589 5763, peetu101@live.com', '7000', '{
  "date_modified": "2022-01-21T12:26:51",
  "customer_ip_address": "185.166.28.117",
  "date_modified_gmt": "2022-01-21T10:26:51",
  "customer_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36 Edg/97.0.1072.62",
  "payment_method": "paytrail",
  "customer_note": "Haluaisin toimituksen postin palvelupisteeseen, K-market Mussalo, Harjantauksentie 11, 48310 KOTKA",
  "payment_method_title": "Paytrail",
  "billing": {
    "postcode": "48310",
    "email": "peetu101@live.com",
    "company": "",
    "address_1": "Kompassikuja 5 A18",
    "address_2": "",
    "state": "",
    "first_name": "Pekka",
    "last_name": "Suoknuuti",
    "city": "KOTKA",
    "phone": "040 589 5763",
    "country": "FI"
  },
  "date_paid": "2022-01-19T10:30:00",
  "created_via": "checkout",
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "customer": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/customers/731"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/6019"
      }
    ]
  },
  "customer_id": 731,
  "date_paid_gmt": "2022-01-19T08:30:00",
  "date_completed": "2022-01-21T12:26:51",
  "date_completed_gmt": "2022-01-21T10:26:51",
  "currency": "EUR",
  "order_key": "wc_order_oahME8RVcPUO4",
  "line_items": [
    {
      "product_id": 1637,
      "name": "Silvertex Beige 122-1010",
      "sku": "122-1010",
      "variation_id": 0,
      "quantity": 2,
      "tax_class": "",
      "subtotal_tax": "15.48",
      "total_tax": "15.48",
      "id": 7703,
      "price": 32.26,
      "total": "64.52",
      "meta_data": [],
      "taxes": [
        {
          "total": "15.4848",
          "id": 1,
          "subtotal": "15.4848"
        }
      ],
      "subtotal": "64.52"
    },
    {
      "product_id": 1641,
      "name": "Silvertex Meteor 122-4024",
      "sku": "122-4024",
      "variation_id": 0,
      "quantity": 1,
      "tax_class": "",
      "subtotal_tax": "7.74",
      "total_tax": "7.74",
      "id": 7704,
      "price": 32.26,
      "total": "32.26",
      "meta_data": [],
      "taxes": [
        {
          "total": "7.7424",
          "id": 1,
          "subtotal": "7.7424"
        }
      ],
      "subtotal": "32.26"
    }
  ],
  "status": "completed",
  "parent_id": 0,
  "cart_tax": "23.22",
  "shipping_tax": "7.16",
  "shipping_total": "29.84",
  "discount_tax": "0.00",
  "discount_total": "0.00",
  "refunds": [],
  "shipping_lines": [
    {
      "meta_data": [
        {
          "value": "Silvertex Beige 122-1010 &times; 2, Silvertex Meteor 122-4024 &times; 1",
          "id": 57060,
          "key": "Tuotteet"
        }
      ],
      "method_id": "postnord",
      "id": 7705,
      "instance_id": "22",
      "total": "29.84",
      "method_title": "PostNord, kotiovelle tuotuna",
      "taxes": [
        {
          "total": "7.16129",
          "id": 1,
          "subtotal": ""
        }
      ],
      "total_tax": "7.16"
    }
  ],
  "id": 6019,
  "version": "3.6.2",
  "prices_include_tax": false,
  "transaction_id": "e35eb8a69e",
  "total": "157.00",
  "meta_data": [
    {
      "value": "no",
      "id": 246510,
      "key": "is_vat_exempt"
    }
  ],
  "shipping": {
    "postcode": "48310",
    "company": "",
    "address_1": "Kompassikuja 5 A18",
    "address_2": "",
    "first_name": "Pekka",
    "last_name": "Suoknuuti",
    "state": "",
    "city": "KOTKA",
    "country": "FI"
  },
  "total_tax": "30.38",
  "tax_lines": [
    {
      "rate_code": "FI-ALV.-1",
      "compound": false,
      "id": 7706,
      "label": "alv.",
      "rate_id": 1,
      "tax_total": "23.22",
      "meta_data": [],
      "shipping_tax_total": "7.16"
    }
  ],
  "date_created": "2022-01-19T10:20:36",
  "coupon_lines": [],
  "fee_lines": [],
  "date_created_gmt": "2022-01-19T08:20:36",
  "number": "6019",
  "cart_hash": "c4f8322f2c5b48ce7ab5c0b941fb6df3"
}', '', 'Haluaisin toimituksen postin palvelupisteeseen, K-market Mussalo, Harjantauksentie 11, 48310 KOTKA', 'Suoknuuti Pekka
Kompassikuja 5 A18
48310 KOTKA', '6019', 'AV', 'TI', 'HV', 126.62, '', '20220123.151540.76002.so_  zzy9f84d896921dcrr', 'K', 30.38)
'
INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, json_data.pro_forma_number, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', '', '7000', 'Suoknuuti Pekka
Kompassikuja 5 A18
48310 KOTKA
040 589 5763, peetu101@live.com', '7000', '{
  "date_modified": "2022-01-21T12:26:51",
  "customer_ip_address": "185.166.28.117",
  "date_modified_gmt": "2022-01-21T10:26:51",
  "customer_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36 Edg/97.0.1072.62",
  "payment_method": "paytrail",
  "customer_note": "Haluaisin toimituksen postin palvelupisteeseen, K-market Mussalo, Harjantauksentie 11, 48310 KOTKA",
  "payment_method_title": "Paytrail",
  "billing": {
    "postcode": "48310",
    "email": "peetu101@live.com",
    "company": "",
    "address_1": "Kompassikuja 5 A18",
    "address_2": "",
    "state": "",
    "first_name": "Pekka",
    "last_name": "Suoknuuti",
    "city": "KOTKA",
    "phone": "040 589 5763",
    "country": "FI"
  },
  "date_paid": "2022-01-19T10:30:00",
  "created_via": "checkout",
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "customer": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/customers/731"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/6019"
      }
    ]
  },
  "customer_id": 731,
  "date_paid_gmt": "2022-01-19T08:30:00",
  "date_completed": "2022-01-21T12:26:51",
  "date_completed_gmt": "2022-01-21T10:26:51",
  "currency": "EUR",
  "order_key": "wc_order_oahME8RVcPUO4",
  "line_items": [
    {
      "product_id": 1637,
      "name": "Silvertex Beige 122-1010",
      "sku": "122-1010",
      "variation_id": 0,
      "quantity": 2,
      "tax_class": "",
      "subtotal_tax": "15.48",
      "total_tax": "15.48",
      "id": 7703,
      "price": 32.26,
      "total": "64.52",
      "meta_data": [],
      "taxes": [
        {
          "total": "15.4848",
          "id": 1,
          "subtotal": "15.4848"
        }
      ],
      "subtotal": "64.52"
    },
    {
      "product_id": 1641,
      "name": "Silvertex Meteor 122-4024",
      "sku": "122-4024",
      "variation_id": 0,
      "quantity": 1,
      "tax_class": "",
      "subtotal_tax": "7.74",
      "total_tax": "7.74",
      "id": 7704,
      "price": 32.26,
      "total": "32.26",
      "meta_data": [],
      "taxes": [
        {
          "total": "7.7424",
          "id": 1,
          "subtotal": "7.7424"
        }
      ],
      "subtotal": "32.26"
    }
  ],
  "status": "completed",
  "parent_id": 0,
  "cart_tax": "23.22",
  "shipping_tax": "7.16",
  "shipping_total": "29.84",
  "discount_tax": "0.00",
  "discount_total": "0.00",
  "refunds": [],
  "shipping_lines": [
    {
      "meta_data": [
        {
          "value": "Silvertex Beige 122-1010 &times; 2, Silvertex Meteor 122-4024 &times; 1",
          "id": 57060,
          "key": "Tuotteet"
        }
      ],
      "method_id": "postnord",
      "id": 7705,
      "instance_id": "22",
      "total": "29.84",
      "method_title": "PostNord, kotiovelle tuotuna",
      "taxes": [
        {
          "total": "7.16129",
          "id": 1,
          "subtotal": ""
        }
      ],
      "total_tax": "7.16"
    }
  ],
  "id": 6019,
  "version": "3.6.2",
  "prices_include_tax": false,
  "transaction_id": "e35eb8a69e",
  "total": "157.00",
  "meta_data": [
    {
      "value": "no",
      "id": 246510,
      "key": "is_vat_exempt"
    }
  ],
  "shipping": {
    "postcode": "48310",
    "company": "",
    "address_1": "Kompassikuja 5 A18",
    "address_2": "",
    "first_name": "Pekka",
    "last_name": "Suoknuuti",
    "state": "",
    "city": "KOTKA",
    "country": "FI"
  },
  "total_tax": "30.38",
  "tax_lines": [
    {
      "rate_code": "FI-ALV.-1",
      "compound": false,
      "id": 7706,
      "label": "alv.",
      "rate_id": 1,
      "tax_total": "23.22",
      "meta_data": [],
      "shipping_tax_total": "7.16"
    }
  ],
  "date_created": "2022-01-19T10:20:36",
  "coupon_lines": [],
  "fee_lines": [],
  "date_created_gmt": "2022-01-19T08:20:36",
  "number": "6019",
  "cart_hash": "c4f8322f2c5b48ce7ab5c0b941fb6df3"
}', '', 'Haluaisin toimituksen postin palvelupisteeseen, K-market Mussalo, Harjantauksentie 11, 48310 KOTKA', 'Suoknuuti Pekka
Kompassikuja 5 A18
48310 KOTKA', '6019', 'AV', 'TI', 'HV', 126.62, '', '20220123.151540.76002.so_  zzy9f84d896921dcrr', 'K', 30.38)
'
 	23.1.2022 	15:15:40 	_lx_ExecuteSqlNew 	(5. palvelin)

warning: 
*** sql error: 4d execute sql error -1: Error -1, Table 'JSON_DATA' is not declared in the FROM clause. (SQLS 1103)
Failed to validate column 'PRO_FORMA_NUMBER'. (SQLS 1717)
Failed to validate INSERT command. (SQLS 1727)
Table 'JSON_DATA' is not declared in the FROM clause.Failed to validate INSERT command. (SQLS 1103)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, json_data.pro_forma_number, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', '', '7000', 'Suoknuuti Pekka
Kompassikuja 5 A18
48310 KOTKA
040 589 5763, peetu101@live.com', '7000', '{
  "date_modified": "2022-01-21T12:26:51",
  "customer_ip_address": "185.166.28.117",
  "date_modified_gmt": "2022-01-21T10:26:51",
  "customer_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36 Edg/97.0.1072.62",
  "payment_method": "paytrail",
  "customer_note": "Haluaisin toimituksen postin palvelupisteeseen, K-market Mussalo, Harjantauksentie 11, 48310 KOTKA",
  "payment_method_title": "Paytrail",
  "billing": {
    "postcode": "48310",
    "email": "peetu101@live.com",
    "company": "",
    "address_1": "Kompassikuja 5 A18",
    "address_2": "",
    "state": "",
    "first_name": "Pekka",
    "last_name": "Suoknuuti",
    "city": "KOTKA",
    "phone": "040 589 5763",
    "country": "FI"
  },
  "date_paid": "2022-01-19T10:30:00",
  "created_via": "checkout",
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "customer": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/customers/731"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/6019"
      }
    ]
  },
  "customer_id": 731,
  "date_paid_gmt": "2022-01-19T08:30:00",
  "date_completed": "2022-01-21T12:26:51",
  "date_completed_gmt": "2022-01-21T10:26:51",
  "currency": "EUR",
  "order_key": "wc_order_oahME8RVcPUO4",
  "line_items": [
    {
      "product_id": 1637,
      "name": "Silvertex Beige 122-1010",
      "sku": "122-1010",
      "variation_id": 0,
      "quantity": 2,
      "tax_class": "",
      "subtotal_tax": "15.48",
      "total_tax": "15.48",
      "id": 7703,
      "price": 32.26,
      "total": "64.52",
      "meta_data": [],
      "taxes": [
        {
          "total": "15.4848",
          "id": 1,
          "subtotal": "15.4848"
        }
      ],
      "subtotal": "64.52"
    },
    {
      "product_id": 1641,
      "name": "Silvertex Meteor 122-4024",
      "sku": "122-4024",
      "variation_id": 0,
      "quantity": 1,
      "tax_class": "",
      "subtotal_tax": "7.74",
      "total_tax": "7.74",
      "id": 7704,
      "price": 32.26,
      "total": "32.26",
      "meta_data": [],
      "taxes": [
        {
          "total": "7.7424",
          "id": 1,
          "subtotal": "7.7424"
        }
      ],
      "subtotal": "32.26"
    }
  ],
  "status": "completed",
  "parent_id": 0,
  "cart_tax": "23.22",
  "shipping_tax": "7.16",
  "shipping_total": "29.84",
  "discount_tax": "0.00",
  "discount_total": "0.00",
  "refunds": [],
  "shipping_lines": [
    {
      "meta_data": [
        {
          "value": "Silvertex Beige 122-1010 &times; 2, Silvertex Meteor 122-4024 &times; 1",
          "id": 57060,
          "key": "Tuotteet"
        }
      ],
      "method_id": "postnord",
      "id": 7705,
      "instance_id": "22",
      "total": "29.84",
      "method_title": "PostNord, kotiovelle tuotuna",
      "taxes": [
        {
          "total": "7.16129",
          "id": 1,
          "subtotal": ""
        }
      ],
      "total_tax": "7.16"
    }
  ],
  "id": 6019,
  "version": "3.6.2",
  "prices_include_tax": false,
  "transaction_id": "e35eb8a69e",
  "total": "157.00",
  "meta_data": [
    {
      "value": "no",
      "id": 246510,
      "key": "is_vat_exempt"
    }
  ],
  "shipping": {
    "postcode": "48310",
    "company": "",
    "address_1": "Kompassikuja 5 A18",
    "address_2": "",
    "first_name": "Pekka",
    "last_name": "Suoknuuti",
    "state": "",
    "city": "KOTKA",
    "country": "FI"
  },
  "total_tax": "30.38",
  "tax_lines": [
    {
      "rate_code": "FI-ALV.-1",
      "compound": false,
      "id": 7706,
      "label": "alv.",
      "rate_id": 1,
      "tax_total": "23.22",
      "meta_data": [],
      "shipping_tax_total": "7.16"
    }
  ],
  "date_created": "2022-01-19T10:20:36",
  "coupon_lines": [],
  "fee_lines": [],
  "date_created_gmt": "2022-01-19T08:20:36",
  "number": "6019",
  "cart_hash": "c4f8322f2c5b48ce7ab5c0b941fb6df3"
}', '', 'Haluaisin toimituksen postin palvelupisteeseen, K-market Mussalo, Harjantauksentie 11, 48310 KOTKA', 'Suoknuuti Pekka
Kompassikuja 5 A18
48310 KOTKA', '6019', 'AV', 'TI', 'HV', 126.62, '', '20220123.151540.76002.so_  zzy9f84d896921dcrr', 'K', 30.38) 
INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, json_data.pro_forma_number, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', '', '7000', 'Suoknuuti Pekka
Kompassikuja 5 A18
48310 KOTKA
040 589 5763, peetu101@live.com', '7000', '{
  "date_modified": "2022-01-21T12:26:51",
  "customer_ip_address": "185.166.28.117",
  "date_modified_gmt": "2022-01-21T10:26:51",
  "customer_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36 Edg/97.0.1072.62",
  "payment_method": "paytrail",
  "customer_note": "Haluaisin toimituksen postin palvelupisteeseen, K-market Mussalo, Harjantauksentie 11, 48310 KOTKA",
  "payment_method_title": "Paytrail",
  "billing": {
    "postcode": "48310",
    "email": "peetu101@live.com",
    "company": "",
    "address_1": "Kompassikuja 5 A18",
    "address_2": "",
    "state": "",
    "first_name": "Pekka",
    "last_name": "Suoknuuti",
    "city": "KOTKA",
    "phone": "040 589 5763",
    "country": "FI"
  },
  "date_paid": "2022-01-19T10:30:00",
  "created_via": "checkout",
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "customer": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/customers/731"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/6019"
      }
    ]
  },
  "customer_id": 731,
  "date_paid_gmt": "2022-01-19T08:30:00",
  "date_completed": "2022-01-21T12:26:51",
  "date_completed_gmt": "2022-01-21T10:26:51",
  "currency": "EUR",
  "order_key": "wc_order_oahME8RVcPUO4",
  "line_items": [
    {
      "product_id": 1637,
      "name": "Silvertex Beige 122-1010",
      "sku": "122-1010",
      "variation_id": 0,
      "quantity": 2,
      "tax_class": "",
      "subtotal_tax": "15.48",
      "total_tax": "15.48",
      "id": 7703,
      "price": 32.26,
      "total": "64.52",
      "meta_data": [],
      "taxes": [
        {
          "total": "15.4848",
          "id": 1,
          "subtotal": "15.4848"
        }
      ],
      "subtotal": "64.52"
    },
    {
      "product_id": 1641,
      "name": "Silvertex Meteor 122-4024",
      "sku": "122-4024",
      "variation_id": 0,
      "quantity": 1,
      "tax_class": "",
      "subtotal_tax": "7.74",
      "total_tax": "7.74",
      "id": 7704,
      "price": 32.26,
      "total": "32.26",
      "meta_data": [],
      "taxes": [
        {
          "total": "7.7424",
          "id": 1,
          "subtotal": "7.7424"
        }
      ],
      "subtotal": "32.26"
    }
  ],
  "status": "completed",
  "parent_id": 0,
  "cart_tax": "23.22",
  "shipping_tax": "7.16",
  "shipping_total": "29.84",
  "discount_tax": "0.00",
  "discount_total": "0.00",
  "refunds": [],
  "shipping_lines": [
    {
      "meta_data": [
        {
          "value": "Silvertex Beige 122-1010 &times; 2, Silvertex Meteor 122-4024 &times; 1",
          "id": 57060,
          "key": "Tuotteet"
        }
      ],
      "method_id": "postnord",
      "id": 7705,
      "instance_id": "22",
      "total": "29.84",
      "method_title": "PostNord, kotiovelle tuotuna",
      "taxes": [
        {
          "total": "7.16129",
          "id": 1,
          "subtotal": ""
        }
      ],
      "total_tax": "7.16"
    }
  ],
  "id": 6019,
  "version": "3.6.2",
  "prices_include_tax": false,
  "transaction_id": "e35eb8a69e",
  "total": "157.00",
  "meta_data": [
    {
      "value": "no",
      "id": 246510,
      "key": "is_vat_exempt"
    }
  ],
  "shipping": {
    "postcode": "48310",
    "company": "",
    "address_1": "Kompassikuja 5 A18",
    "address_2": "",
    "first_name": "Pekka",
    "last_name": "Suoknuuti",
    "state": "",
    "city": "KOTKA",
    "country": "FI"
  },
  "total_tax": "30.38",
  "tax_lines": [
    {
      "rate_code": "FI-ALV.-1",
      "compound": false,
      "id": 7706,
      "label": "alv.",
      "rate_id": 1,
      "tax_total": "23.22",
      "meta_data": [],
      "shipping_tax_total": "7.16"
    }
  ],
  "date_created": "2022-01-19T10:20:36",
  "coupon_lines": [],
  "fee_lines": [],
  "date_created_gmt": "2022-01-19T08:20:36",
  "number": "6019",
  "cart_hash": "c4f8322f2c5b48ce7ab5c0b941fb6df3"
}', '', 'Haluaisin toimituksen postin palvelupisteeseen, K-market Mussalo, Harjantauksentie 11, 48310 KOTKA', 'Suoknuuti Pekka
Kompassikuja 5 A18
48310 KOTKA', '6019', 'AV', 'TI', 'HV', 126.62, '', '20220123.151540.76002.so_  zzy9f84d896921dcrr', 'K', 30.38)


. 	23.1.2022 	15:15:40 	lx 	(5. palvelin)

4d execute sql error -1: Error -1, Table 'JSON_DATA' is not declared in the FROM clause. (SQLS 1103)
Failed to validate column 'PRO_FORMA_NUMBER'. (SQLS 1717)
Failed to validate INSERT command. (SQLS 1727)
Table 'JSON_DATA' is not declared in the FROM clause.Failed to validate INSERT command. (SQLS 1103)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, json_data.pro_forma_number, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', '', '7000', 'Suoknuuti Pekka
Kompassikuja 5 A18
48310 KOTKA
040 589 5763, peetu101@live.com', '7000', '{
  "date_modified": "2022-01-21T12:26:51",
  "customer_ip_address": "185.166.28.117",
  "date_modified_gmt": "2022-01-21T10:26:51",
  "customer_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36 Edg/97.0.1072.62",
  "payment_method": "paytrail",
  "customer_note": "Haluaisin toimituksen postin palvelupisteeseen, K-market Mussalo, Harjantauksentie 11, 48310 KOTKA",
  "payment_method_title": "Paytrail",
  "billing": {
    "postcode": "48310",
    "email": "peetu101@live.com",
    "company": "",
    "address_1": "Kompassikuja 5 A18",
    "address_2": "",
    "state": "",
    "first_name": "Pekka",
    "last_name": "Suoknuuti",
    "city": "KOTKA",
    "phone": "040 589 5763",
    "country": "FI"
  },
  "date_paid": "2022-01-19T10:30:00",
  "created_via": "checkout",
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "customer": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/customers/731"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/6019"
      }
    ]
  },
  "customer_id": 731,
  "date_paid_gmt": "2022-01-19T08:30:00",
  "date_completed": "2022-01-21T12:26:51",
  "date_completed_gmt": "2022-01-21T10:26:51",
  "currency": "EUR",
  "order_key": "wc_order_oahME8RVcPUO4",
  "line_items": [
    {
      "product_id": 1637,
      "name": "Silvertex Beige 122-1010",
      "sku": "122-1010",
      "variation_id": 0,
      "quantity": 2,
      "tax_class": "",
      "subtotal_tax": "15.48",
      "total_tax": "15.48",
      "id": 7703,
      "price": 32.26,
      "total": "64.52",
      "meta_data": [],
      "taxes": [
        {
          "total": "15.4848",
          "id": 1,
          "subtotal": "15.4848"
        }
      ],
      "subtotal": "64.52"
    },
    {
      "product_id": 1641,
      "name": "Silvertex Meteor 122-4024",
      "sku": "122-4024",
      "variation_id": 0,
      "quantity": 1,
      "tax_class": "",
      "subtotal_tax": "7.74",
      "total_tax": "7.74",
      "id": 7704,
      "price": 32.26,
      "total": "32.26",
      "meta_data": [],
      "taxes": [
        {
          "total": "7.7424",
          "id": 1,
          "subtotal": "7.7424"
        }
      ],
      "subtotal": "32.26"
    }
  ],
  "status": "completed",
  "parent_id": 0,
  "cart_tax": "23.22",
  "shipping_tax": "7.16",
  "shipping_total": "29.84",
  "discount_tax": "0.00",
  "discount_total": "0.00",
  "refunds": [],
  "shipping_lines": [
    {
      "meta_data": [
        {
          "value": "Silvertex Beige 122-1010 &times; 2, Silvertex Meteor 122-4024 &times; 1",
          "id": 57060,
          "key": "Tuotteet"
        }
      ],
      "method_id": "postnord",
      "id": 7705,
      "instance_id": "22",
      "total": "29.84",
      "method_title": "PostNord, kotiovelle tuotuna",
      "taxes": [
        {
          "total": "7.16129",
          "id": 1,
          "subtotal": ""
        }
      ],
      "total_tax": "7.16"
    }
  ],
  "id": 6019,
  "version": "3.6.2",
  "prices_include_tax": false,
  "transaction_id": "e35eb8a69e",
  "total": "157.00",
  "meta_data": [
    {
      "value": "no",
      "id": 246510,
      "key": "is_vat_exempt"
    }
  ],
  "shipping": {
    "postcode": "48310",
    "company": "",
    "address_1": "Kompassikuja 5 A18",
    "address_2": "",
    "first_name": "Pekka",
    "last_name": "Suoknuuti",
    "state": "",
    "city": "KOTKA",
    "country": "FI"
  },
  "total_tax": "30.38",
  "tax_lines": [
    {
      "rate_code": "FI-ALV.-1",
      "compound": false,
      "id": 7706,
      "label": "alv.",
      "rate_id": 1,
      "tax_total": "23.22",
      "meta_data": [],
      "shipping_tax_total": "7.16"
    }
  ],
  "date_created": "2022-01-19T10:20:36",
  "coupon_lines": [],
  "fee_lines": [],
  "date_created_gmt": "2022-01-19T08:20:36",
  "number": "6019",
  "cart_hash": "c4f8322f2c5b48ce7ab5c0b941fb6df3"
}', '', 'Haluaisin toimituksen postin palvelupisteeseen, K-market Mussalo, Harjantauksentie 11, 48310 KOTKA', 'Suoknuuti Pekka
Kompassikuja 5 A18
48310 KOTKA', '6019', 'AV', 'TI', 'HV', 126.62, '', '20220123.151540.76002.so_  zzy9f84d896921dcrr', 'K', 30.38). 	23.1.2022 	15:15:40 	_lx_SERVER 	(5. palvelin)

4D: SELECT so.record_id FROM sales_order so WHERE so.project_id <> '' LIMIT 500 INTO :_lx_atExe1
 - original query: SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id FROM sales_order so  WHERE so.project_id <> ''  ORDER BY so.sales_order_id DESC  LIMIT 500  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8
 - result _lx_atExe1 size: 500, first value: '2001066'
 - query name: new:form/nc/erp-sync/woocommerce/query-local/order-sales.json. 	23.1.2022 	15:15:41 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 12, send result: -1, send count: 2, loop count: 2, bytes sent 163320 / 342010, 178690 remaining, total send time 3 µs. 	23.1.2022 	15:15:41 	lx 	(5. palvelin)

 -- tcp answer 12, send result: -1, send count: 3, loop count: 4, bytes sent 244980 / 342010, 97030 remaining, total send time 1259 µs. 	23.1.2022 	15:15:41 	lx 	(5. palvelin)

 -- tcp answer 12, send result: -1, send count: 4, loop count: 6, bytes sent 326640 / 342010, 15370 remaining, total send time 2497 µs. 	23.1.2022 	15:15:41 	lx 	(5. palvelin)

 -- tcp answer 12, send count: 5, loop count: 7, bytes sent 342010 / 342010, 0 remaining, total send time 3755 µs. 	23.1.2022 	15:15:41 	lx 	(5. palvelin)

*** tcp close for sock 77, type 'nil', protocol 'HTTP', reason: 'POLLHUP', request length: 1 075 bytes ***. 	23.1.2022 	15:15:47 	lx 	(5. palvelin)

closing socket '77'. 	23.1.2022 	15:15:47 	lx 	(5. palvelin)

4D: SELECT _prf.record_id FROM _preference _prf WHERE name_id = '_code_SiteCode' INTO :_lx_atExe1
 - original query: SELECT text_value FROM _preference WHERE name_id = '_code_SiteCode'  INTO :_lx_atExe1
 - result _lx_atExe1 size: 1, first value: 'ZZY0'
 - query name: new:dsql.sqlExecuteUnsafe. 	23.1.2022 	15:15:53 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT _prf.record_id FROM _preference _prf WHERE name_id = 'code_default.json' INTO :_lx_atExe1
 - original query: SELECT text_value FROM _preference WHERE name_id = 'code_default.json'  INTO :_lx_atExe1
 - result _lx_atExe1 size: 1, first value: '{
  "code": {
    "_CODE_ALFLD": [4002, 4002, 4002, 4013, 4013, 4013, 8011, 8011, 10004, 11005, 17004, 17004, 17004, 17004, 17004, 17004, 21001, 21001, 21001, 21001, 21001, 21001, 26002, 27001, 28008, 28008, 29001, 29001, 31001, 31001, 31011, 32002, 32002, 33001, 37001, 37001, 42001, 43002, 44012, 44031, 44031, 44032, 48036, 50001, 54001],
    "_CODE_ASFLDNAME": ["[Tosite]TUNNUS", "[Tosite]Tosite ID", "[Tosite]TUNNUS", "[Tosite]Tositenumero", "[Tosite]Tositenumero", "[Tosite]Tositenumero", "[Var'
 - query name: new:dsql.sqlExecuteUnsafe. 	23.1.2022 	15:15:53 	_lx_ExecuteSqlNew 	(5. palvelin)

sql: Error -1, Table 'JSON_DATA' is not declared in the FROM clause. (SQLS 1103)
Failed to validate column 'PRO_FORMA_NUMBER'. (SQLS 1717)
Failed to validate INSERT command. (SQLS 1727)
Table 'JSON_DATA' is not declared in the FROM clause.Failed to validate INSERT command. (SQLS 1103)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, json_data.pro_forma_number, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', '', '7000', 'Suoknuuti Pekka
Kompassikuja 5 A18
48310 KOTKA
040 589 5763, peetu101@live.com', '7000', '{
  "customer_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36 Edg/97.0.1072.62",
  "customer_note": "Haluaisin toimituksen postin palvelupisteeseen, K-market Mussalo, Harjantauksentie 11, 48310 KOTKA",
  "billing": {
    "state": "",
    "address_2": "",
    "city": "KOTKA",
    "postcode": "48310",
    "country": "FI",
    "email": "peetu101@live.com",
    "first_name": "Pekka",
    "last_name": "Suoknuuti",
    "company": "",
    "phone": "040 589 5763",
    "address_1": "Kompassikuja 5 A18"
  },
  "refunds": [],
  "shipping_lines": [
    {
      "total": "29.84",
      "meta_data": [
        {
          "value": "Silvertex Beige 122-1010 &times; 2, Silvertex Meteor 122-4024 &times; 1",
          "key": "Tuotteet",
          "id": 57060
        }
      ],
      "method_id": "postnord",
      "method_title": "PostNord, kotiovelle tuotuna",
      "instance_id": "22",
      "total_tax": "7.16",
      "taxes": [
        {
          "subtotal": "",
          "total": "7.16129",
          "id": 1
        }
      ],
      "id": 7705
    }
  ],
  "status": "completed",
  "tax_lines": [
    {
      "rate_id": 1,
      "compound": false,
      "meta_data": [],
      "label": "alv.",
      "rate_code": "FI-ALV.-1",
      "tax_total": "23.22",
      "shipping_tax_total": "7.16",
      "id": 7706
    }
  ],
  "meta_data": [
    {
      "value": "no",
      "key": "is_vat_exempt",
      "id": 246510
    }
  ],
  "transaction_id": "e35eb8a69e",
  "date_created": "2022-01-19T10:20:36",
  "fee_lines": [],
  "date_created_gmt": "2022-01-19T08:20:36",
  "date_modified_gmt": "2022-01-21T10:26:51",
  "cart_hash": "c4f8322f2c5b48ce7ab5c0b941fb6df3",
  "date_modified": "2022-01-21T12:26:51",
  "shipping": {
    "state": "",
    "address_2": "",
    "city": "KOTKA",
    "postcode": "48310",
    "first_name": "Pekka",
    "last_name": "Suoknuuti",
    "country": "FI",
    "company": "",
    "address_1": "Kompassikuja 5 A18"
  },
  "payment_method": "paytrail",
  "shipping_tax": "7.16",
  "coupon_lines": [],
  "date_paid": "2022-01-19T10:30:00",
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "customer": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/customers/731"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/6019"
      }
    ]
  },
  "date_paid_gmt": "2022-01-19T08:30:00",
  "number": "6019",
  "date_completed": "2022-01-21T12:26:51",
  "cart_tax": "23.22",
  "date_completed_gmt": "2022-01-21T10:26:51",
  "created_via": "checkout",
  "customer_id": 731,
  "payment_method_title": "Paytrail",
  "shipping_total": "29.84",
  "order_key": "wc_order_oahME8RVcPUO4",
  "discount_tax": "0.00",
  "line_items": [
    {
      "subtotal_tax": "15.48",
      "meta_data": [],
      "name": "Silvertex Beige 122-1010",
      "id": 7703,
      "product_id": 1637,
      "taxes": [
        {
          "subtotal": "15.4848",
          "total": "15.4848",
          "id": 1
        }
      ],
      "total": "64.52",
      "subtotal": "64.52",
      "total_tax": "15.48",
      "sku": "122-1010",
      "quantity": 2,
      "variation_id": 0,
      "price": 32.26,
      "tax_class": ""
    },
    {
      "subtotal_tax": "7.74",
      "meta_data": [],
      "name": "Silvertex Meteor 122-4024",
      "id": 7704,
      "product_id": 1641,
      "taxes": [
        {
          "subtotal": "7.7424",
          "total": "7.7424",
          "id": 1
        }
      ],
      "total": "32.26",
      "subtotal": "32.26",
      "total_tax": "7.74",
      "sku": "122-4024",
      "quantity": 1,
      "variation_id": 0,
      "price": 32.26,
      "tax_class": ""
    }
  ],
  "id": 6019,
  "total": "157.00",
  "discount_total": "0.00",
  "total_tax": "30.38",
  "version": "3.6.2",
  "currency": "EUR",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "parent_id": 0
}', '', 'Haluaisin toimituksen postin palvelupisteeseen, K-market Mussalo, Harjantauksentie 11, 48310 KOTKA', 'Suoknuuti Pekka
Kompassikuja 5 A18
48310 KOTKA', '6019', 'AV', 'TI', 'HV', 126.62, '', '20220123.151553.fu001.so_  zzy9f84d896921dcrr', 'K', 30.38)
'
INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, json_data.pro_forma_number, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', '', '7000', 'Suoknuuti Pekka
Kompassikuja 5 A18
48310 KOTKA
040 589 5763, peetu101@live.com', '7000', '{
  "customer_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36 Edg/97.0.1072.62",
  "customer_note": "Haluaisin toimituksen postin palvelupisteeseen, K-market Mussalo, Harjantauksentie 11, 48310 KOTKA",
  "billing": {
    "state": "",
    "address_2": "",
    "city": "KOTKA",
    "postcode": "48310",
    "country": "FI",
    "email": "peetu101@live.com",
    "first_name": "Pekka",
    "last_name": "Suoknuuti",
    "company": "",
    "phone": "040 589 5763",
    "address_1": "Kompassikuja 5 A18"
  },
  "refunds": [],
  "shipping_lines": [
    {
      "total": "29.84",
      "meta_data": [
        {
          "value": "Silvertex Beige 122-1010 &times; 2, Silvertex Meteor 122-4024 &times; 1",
          "key": "Tuotteet",
          "id": 57060
        }
      ],
      "method_id": "postnord",
      "method_title": "PostNord, kotiovelle tuotuna",
      "instance_id": "22",
      "total_tax": "7.16",
      "taxes": [
        {
          "subtotal": "",
          "total": "7.16129",
          "id": 1
        }
      ],
      "id": 7705
    }
  ],
  "status": "completed",
  "tax_lines": [
    {
      "rate_id": 1,
      "compound": false,
      "meta_data": [],
      "label": "alv.",
      "rate_code": "FI-ALV.-1",
      "tax_total": "23.22",
      "shipping_tax_total": "7.16",
      "id": 7706
    }
  ],
  "meta_data": [
    {
      "value": "no",
      "key": "is_vat_exempt",
      "id": 246510
    }
  ],
  "transaction_id": "e35eb8a69e",
  "date_created": "2022-01-19T10:20:36",
  "fee_lines": [],
  "date_created_gmt": "2022-01-19T08:20:36",
  "date_modified_gmt": "2022-01-21T10:26:51",
  "cart_hash": "c4f8322f2c5b48ce7ab5c0b941fb6df3",
  "date_modified": "2022-01-21T12:26:51",
  "shipping": {
    "state": "",
    "address_2": "",
    "city": "KOTKA",
    "postcode": "48310",
    "first_name": "Pekka",
    "last_name": "Suoknuuti",
    "country": "FI",
    "company": "",
    "address_1": "Kompassikuja 5 A18"
  },
  "payment_method": "paytrail",
  "shipping_tax": "7.16",
  "coupon_lines": [],
  "date_paid": "2022-01-19T10:30:00",
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "customer": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/customers/731"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/6019"
      }
    ]
  },
  "date_paid_gmt": "2022-01-19T08:30:00",
  "number": "6019",
  "date_completed": "2022-01-21T12:26:51",
  "cart_tax": "23.22",
  "date_completed_gmt": "2022-01-21T10:26:51",
  "created_via": "checkout",
  "customer_id": 731,
  "payment_method_title": "Paytrail",
  "shipping_total": "29.84",
  "order_key": "wc_order_oahME8RVcPUO4",
  "discount_tax": "0.00",
  "line_items": [
    {
      "subtotal_tax": "15.48",
      "meta_data": [],
      "name": "Silvertex Beige 122-1010",
      "id": 7703,
      "product_id": 1637,
      "taxes": [
        {
          "subtotal": "15.4848",
          "total": "15.4848",
          "id": 1
        }
      ],
      "total": "64.52",
      "subtotal": "64.52",
      "total_tax": "15.48",
      "sku": "122-1010",
      "quantity": 2,
      "variation_id": 0,
      "price": 32.26,
      "tax_class": ""
    },
    {
      "subtotal_tax": "7.74",
      "meta_data": [],
      "name": "Silvertex Meteor 122-4024",
      "id": 7704,
      "product_id": 1641,
      "taxes": [
        {
          "subtotal": "7.7424",
          "total": "7.7424",
          "id": 1
        }
      ],
      "total": "32.26",
      "subtotal": "32.26",
      "total_tax": "7.74",
      "sku": "122-4024",
      "quantity": 1,
      "variation_id": 0,
      "price": 32.26,
      "tax_class": ""
    }
  ],
  "id": 6019,
  "total": "157.00",
  "discount_total": "0.00",
  "total_tax": "30.38",
  "version": "3.6.2",
  "currency": "EUR",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "parent_id": 0
}', '', 'Haluaisin toimituksen postin palvelupisteeseen, K-market Mussalo, Harjantauksentie 11, 48310 KOTKA', 'Suoknuuti Pekka
Kompassikuja 5 A18
48310 KOTKA', '6019', 'AV', 'TI', 'HV', 126.62, '', '20220123.151553.fu001.so_  zzy9f84d896921dcrr', 'K', 30.38)
'
 	23.1.2022 	15:15:54 	_lx_ExecuteSqlNew 	(5. palvelin)

warning: 
*** sql error: 4d execute sql error -1: Error -1, Table 'JSON_DATA' is not declared in the FROM clause. (SQLS 1103)
Failed to validate column 'PRO_FORMA_NUMBER'. (SQLS 1717)
Failed to validate INSERT command. (SQLS 1727)
Table 'JSON_DATA' is not declared in the FROM clause.Failed to validate INSERT command. (SQLS 1103)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, json_data.pro_forma_number, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', '', '7000', 'Suoknuuti Pekka
Kompassikuja 5 A18
48310 KOTKA
040 589 5763, peetu101@live.com', '7000', '{
  "customer_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36 Edg/97.0.1072.62",
  "customer_note": "Haluaisin toimituksen postin palvelupisteeseen, K-market Mussalo, Harjantauksentie 11, 48310 KOTKA",
  "billing": {
    "state": "",
    "address_2": "",
    "city": "KOTKA",
    "postcode": "48310",
    "country": "FI",
    "email": "peetu101@live.com",
    "first_name": "Pekka",
    "last_name": "Suoknuuti",
    "company": "",
    "phone": "040 589 5763",
    "address_1": "Kompassikuja 5 A18"
  },
  "refunds": [],
  "shipping_lines": [
    {
      "total": "29.84",
      "meta_data": [
        {
          "value": "Silvertex Beige 122-1010 &times; 2, Silvertex Meteor 122-4024 &times; 1",
          "key": "Tuotteet",
          "id": 57060
        }
      ],
      "method_id": "postnord",
      "method_title": "PostNord, kotiovelle tuotuna",
      "instance_id": "22",
      "total_tax": "7.16",
      "taxes": [
        {
          "subtotal": "",
          "total": "7.16129",
          "id": 1
        }
      ],
      "id": 7705
    }
  ],
  "status": "completed",
  "tax_lines": [
    {
      "rate_id": 1,
      "compound": false,
      "meta_data": [],
      "label": "alv.",
      "rate_code": "FI-ALV.-1",
      "tax_total": "23.22",
      "shipping_tax_total": "7.16",
      "id": 7706
    }
  ],
  "meta_data": [
    {
      "value": "no",
      "key": "is_vat_exempt",
      "id": 246510
    }
  ],
  "transaction_id": "e35eb8a69e",
  "date_created": "2022-01-19T10:20:36",
  "fee_lines": [],
  "date_created_gmt": "2022-01-19T08:20:36",
  "date_modified_gmt": "2022-01-21T10:26:51",
  "cart_hash": "c4f8322f2c5b48ce7ab5c0b941fb6df3",
  "date_modified": "2022-01-21T12:26:51",
  "shipping": {
    "state": "",
    "address_2": "",
    "city": "KOTKA",
    "postcode": "48310",
    "first_name": "Pekka",
    "last_name": "Suoknuuti",
    "country": "FI",
    "company": "",
    "address_1": "Kompassikuja 5 A18"
  },
  "payment_method": "paytrail",
  "shipping_tax": "7.16",
  "coupon_lines": [],
  "date_paid": "2022-01-19T10:30:00",
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "customer": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/customers/731"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/6019"
      }
    ]
  },
  "date_paid_gmt": "2022-01-19T08:30:00",
  "number": "6019",
  "date_completed": "2022-01-21T12:26:51",
  "cart_tax": "23.22",
  "date_completed_gmt": "2022-01-21T10:26:51",
  "created_via": "checkout",
  "customer_id": 731,
  "payment_method_title": "Paytrail",
  "shipping_total": "29.84",
  "order_key": "wc_order_oahME8RVcPUO4",
  "discount_tax": "0.00",
  "line_items": [
    {
      "subtotal_tax": "15.48",
      "meta_data": [],
      "name": "Silvertex Beige 122-1010",
      "id": 7703,
      "product_id": 1637,
      "taxes": [
        {
          "subtotal": "15.4848",
          "total": "15.4848",
          "id": 1
        }
      ],
      "total": "64.52",
      "subtotal": "64.52",
      "total_tax": "15.48",
      "sku": "122-1010",
      "quantity": 2,
      "variation_id": 0,
      "price": 32.26,
      "tax_class": ""
    },
    {
      "subtotal_tax": "7.74",
      "meta_data": [],
      "name": "Silvertex Meteor 122-4024",
      "id": 7704,
      "product_id": 1641,
      "taxes": [
        {
          "subtotal": "7.7424",
          "total": "7.7424",
          "id": 1
        }
      ],
      "total": "32.26",
      "subtotal": "32.26",
      "total_tax": "7.74",
      "sku": "122-4024",
      "quantity": 1,
      "variation_id": 0,
      "price": 32.26,
      "tax_class": ""
    }
  ],
  "id": 6019,
  "total": "157.00",
  "discount_total": "0.00",
  "total_tax": "30.38",
  "version": "3.6.2",
  "currency": "EUR",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "parent_id": 0
}', '', 'Haluaisin toimituksen postin palvelupisteeseen, K-market Mussalo, Harjantauksentie 11, 48310 KOTKA', 'Suoknuuti Pekka
Kompassikuja 5 A18
48310 KOTKA', '6019', 'AV', 'TI', 'HV', 126.62, '', '20220123.151553.fu001.so_  zzy9f84d896921dcrr', 'K', 30.38) 
INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, json_data.pro_forma_number, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', '', '7000', 'Suoknuuti Pekka
Kompassikuja 5 A18
48310 KOTKA
040 589 5763, peetu101@live.com', '7000', '{
  "customer_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36 Edg/97.0.1072.62",
  "customer_note": "Haluaisin toimituksen postin palvelupisteeseen, K-market Mussalo, Harjantauksentie 11, 48310 KOTKA",
  "billing": {
    "state": "",
    "address_2": "",
    "city": "KOTKA",
    "postcode": "48310",
    "country": "FI",
    "email": "peetu101@live.com",
    "first_name": "Pekka",
    "last_name": "Suoknuuti",
    "company": "",
    "phone": "040 589 5763",
    "address_1": "Kompassikuja 5 A18"
  },
  "refunds": [],
  "shipping_lines": [
    {
      "total": "29.84",
      "meta_data": [
        {
          "value": "Silvertex Beige 122-1010 &times; 2, Silvertex Meteor 122-4024 &times; 1",
          "key": "Tuotteet",
          "id": 57060
        }
      ],
      "method_id": "postnord",
      "method_title": "PostNord, kotiovelle tuotuna",
      "instance_id": "22",
      "total_tax": "7.16",
      "taxes": [
        {
          "subtotal": "",
          "total": "7.16129",
          "id": 1
        }
      ],
      "id": 7705
    }
  ],
  "status": "completed",
  "tax_lines": [
    {
      "rate_id": 1,
      "compound": false,
      "meta_data": [],
      "label": "alv.",
      "rate_code": "FI-ALV.-1",
      "tax_total": "23.22",
      "shipping_tax_total": "7.16",
      "id": 7706
    }
  ],
  "meta_data": [
    {
      "value": "no",
      "key": "is_vat_exempt",
      "id": 246510
    }
  ],
  "transaction_id": "e35eb8a69e",
  "date_created": "2022-01-19T10:20:36",
  "fee_lines": [],
  "date_created_gmt": "2022-01-19T08:20:36",
  "date_modified_gmt": "2022-01-21T10:26:51",
  "cart_hash": "c4f8322f2c5b48ce7ab5c0b941fb6df3",
  "date_modified": "2022-01-21T12:26:51",
  "shipping": {
    "state": "",
    "address_2": "",
    "city": "KOTKA",
    "postcode": "48310",
    "first_name": "Pekka",
    "last_name": "Suoknuuti",
    "country": "FI",
    "company": "",
    "address_1": "Kompassikuja 5 A18"
  },
  "payment_method": "paytrail",
  "shipping_tax": "7.16",
  "coupon_lines": [],
  "date_paid": "2022-01-19T10:30:00",
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "customer": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/customers/731"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/6019"
      }
    ]
  },
  "date_paid_gmt": "2022-01-19T08:30:00",
  "number": "6019",
  "date_completed": "2022-01-21T12:26:51",
  "cart_tax": "23.22",
  "date_completed_gmt": "2022-01-21T10:26:51",
  "created_via": "checkout",
  "customer_id": 731,
  "payment_method_title": "Paytrail",
  "shipping_total": "29.84",
  "order_key": "wc_order_oahME8RVcPUO4",
  "discount_tax": "0.00",
  "line_items": [
    {
      "subtotal_tax": "15.48",
      "meta_data": [],
      "name": "Silvertex Beige 122-1010",
      "id": 7703,
      "product_id": 1637,
      "taxes": [
        {
          "subtotal": "15.4848",
          "total": "15.4848",
          "id": 1
        }
      ],
      "total": "64.52",
      "subtotal": "64.52",
      "total_tax": "15.48",
      "sku": "122-1010",
      "quantity": 2,
      "variation_id": 0,
      "price": 32.26,
      "tax_class": ""
    },
    {
      "subtotal_tax": "7.74",
      "meta_data": [],
      "name": "Silvertex Meteor 122-4024",
      "id": 7704,
      "product_id": 1641,
      "taxes": [
        {
          "subtotal": "7.7424",
          "total": "7.7424",
          "id": 1
        }
      ],
      "total": "32.26",
      "subtotal": "32.26",
      "total_tax": "7.74",
      "sku": "122-4024",
      "quantity": 1,
      "variation_id": 0,
      "price": 32.26,
      "tax_class": ""
    }
  ],
  "id": 6019,
  "total": "157.00",
  "discount_total": "0.00",
  "total_tax": "30.38",
  "version": "3.6.2",
  "currency": "EUR",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "parent_id": 0
}', '', 'Haluaisin toimituksen postin palvelupisteeseen, K-market Mussalo, Harjantauksentie 11, 48310 KOTKA', 'Suoknuuti Pekka
Kompassikuja 5 A18
48310 KOTKA', '6019', 'AV', 'TI', 'HV', 126.62, '', '20220123.151553.fu001.so_  zzy9f84d896921dcrr', 'K', 30.38)


. 	23.1.2022 	15:15:54 	lx 	(5. palvelin)

4d execute sql error -1: Error -1, Table 'JSON_DATA' is not declared in the FROM clause. (SQLS 1103)
Failed to validate column 'PRO_FORMA_NUMBER'. (SQLS 1717)
Failed to validate INSERT command. (SQLS 1727)
Table 'JSON_DATA' is not declared in the FROM clause.Failed to validate INSERT command. (SQLS 1103)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, json_data.pro_forma_number, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', '', '7000', 'Suoknuuti Pekka
Kompassikuja 5 A18
48310 KOTKA
040 589 5763, peetu101@live.com', '7000', '{
  "customer_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36 Edg/97.0.1072.62",
  "customer_note": "Haluaisin toimituksen postin palvelupisteeseen, K-market Mussalo, Harjantauksentie 11, 48310 KOTKA",
  "billing": {
    "state": "",
    "address_2": "",
    "city": "KOTKA",
    "postcode": "48310",
    "country": "FI",
    "email": "peetu101@live.com",
    "first_name": "Pekka",
    "last_name": "Suoknuuti",
    "company": "",
    "phone": "040 589 5763",
    "address_1": "Kompassikuja 5 A18"
  },
  "refunds": [],
  "shipping_lines": [
    {
      "total": "29.84",
      "meta_data": [
        {
          "value": "Silvertex Beige 122-1010 &times; 2, Silvertex Meteor 122-4024 &times; 1",
          "key": "Tuotteet",
          "id": 57060
        }
      ],
      "method_id": "postnord",
      "method_title": "PostNord, kotiovelle tuotuna",
      "instance_id": "22",
      "total_tax": "7.16",
      "taxes": [
        {
          "subtotal": "",
          "total": "7.16129",
          "id": 1
        }
      ],
      "id": 7705
    }
  ],
  "status": "completed",
  "tax_lines": [
    {
      "rate_id": 1,
      "compound": false,
      "meta_data": [],
      "label": "alv.",
      "rate_code": "FI-ALV.-1",
      "tax_total": "23.22",
      "shipping_tax_total": "7.16",
      "id": 7706
    }
  ],
  "meta_data": [
    {
      "value": "no",
      "key": "is_vat_exempt",
      "id": 246510
    }
  ],
  "transaction_id": "e35eb8a69e",
  "date_created": "2022-01-19T10:20:36",
  "fee_lines": [],
  "date_created_gmt": "2022-01-19T08:20:36",
  "date_modified_gmt": "2022-01-21T10:26:51",
  "cart_hash": "c4f8322f2c5b48ce7ab5c0b941fb6df3",
  "date_modified": "2022-01-21T12:26:51",
  "shipping": {
    "state": "",
    "address_2": "",
    "city": "KOTKA",
    "postcode": "48310",
    "first_name": "Pekka",
    "last_name": "Suoknuuti",
    "country": "FI",
    "company": "",
    "address_1": "Kompassikuja 5 A18"
  },
  "payment_method": "paytrail",
  "shipping_tax": "7.16",
  "coupon_lines": [],
  "date_paid": "2022-01-19T10:30:00",
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "customer": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/customers/731"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/6019"
      }
    ]
  },
  "date_paid_gmt": "2022-01-19T08:30:00",
  "number": "6019",
  "date_completed": "2022-01-21T12:26:51",
  "cart_tax": "23.22",
  "date_completed_gmt": "2022-01-21T10:26:51",
  "created_via": "checkout",
  "customer_id": 731,
  "payment_method_title": "Paytrail",
  "shipping_total": "29.84",
  "order_key": "wc_order_oahME8RVcPUO4",
  "discount_tax": "0.00",
  "line_items": [
    {
      "subtotal_tax": "15.48",
      "meta_data": [],
      "name": "Silvertex Beige 122-1010",
      "id": 7703,
      "product_id": 1637,
      "taxes": [
        {
          "subtotal": "15.4848",
          "total": "15.4848",
          "id": 1
        }
      ],
      "total": "64.52",
      "subtotal": "64.52",
      "total_tax": "15.48",
      "sku": "122-1010",
      "quantity": 2,
      "variation_id": 0,
      "price": 32.26,
      "tax_class": ""
    },
    {
      "subtotal_tax": "7.74",
      "meta_data": [],
      "name": "Silvertex Meteor 122-4024",
      "id": 7704,
      "product_id": 1641,
      "taxes": [
        {
          "subtotal": "7.7424",
          "total": "7.7424",
          "id": 1
        }
      ],
      "total": "32.26",
      "subtotal": "32.26",
      "total_tax": "7.74",
      "sku": "122-4024",
      "quantity": 1,
      "variation_id": 0,
      "price": 32.26,
      "tax_class": ""
    }
  ],
  "id": 6019,
  "total": "157.00",
  "discount_total": "0.00",
  "total_tax": "30.38",
  "version": "3.6.2",
  "currency": "EUR",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "parent_id": 0
}', '', 'Haluaisin toimituksen postin palvelupisteeseen, K-market Mussalo, Harjantauksentie 11, 48310 KOTKA', 'Suoknuuti Pekka
Kompassikuja 5 A18
48310 KOTKA', '6019', 'AV', 'TI', 'HV', 126.62, '', '20220123.151553.fu001.so_  zzy9f84d896921dcrr', 'K', 30.38). 	23.1.2022 	15:15:54 	_lx_SERVER 	(5. palvelin)

4D: SELECT so.record_id FROM sales_order so WHERE so.project_id <> '' LIMIT 500 INTO :_lx_atExe1
 - original query: SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id FROM sales_order so  WHERE so.project_id <> ''  ORDER BY so.sales_order_id DESC  LIMIT 500  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8
 - result _lx_atExe1 size: 500, first value: '2001066'
 - query name: new:form/nc/erp-sync/woocommerce/query-local/order-sales.json. 	23.1.2022 	15:15:54 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 16, send result: -1, send count: 2, loop count: 2, bytes sent 163320 / 342010, 178690 remaining, total send time 5 µs. 	23.1.2022 	15:15:54 	lx 	(5. palvelin)

 -- tcp answer 16, send result: -1, send count: 3, loop count: 4, bytes sent 244980 / 342010, 97030 remaining, total send time 1241 µs. 	23.1.2022 	15:15:54 	lx 	(5. palvelin)

 -- tcp answer 16, send result: -1, send count: 4, loop count: 6, bytes sent 326640 / 342010, 15370 remaining, total send time 2472 µs. 	23.1.2022 	15:15:54 	lx 	(5. palvelin)

 -- tcp answer 16, send count: 5, loop count: 7, bytes sent 342010 / 342010, 0 remaining, total send time 3765 µs. 	23.1.2022 	15:15:54 	lx 	(5. palvelin)

*** tcp close for sock 77, type 'nil', protocol 'HTTP', reason: 'POLLHUP', request length: 1 089 bytes ***. 	23.1.2022 	15:16:19 	lx 	(5. palvelin)

closing socket '77'. 	23.1.2022 	15:16:19 	lx 	(5. palvelin)

*** tcp close for sock 77, type 'nil', protocol 'nil', reason: 'POLLHUP', request length: (no request) bytes ***. 	23.1.2022 	15:19:51 	lx 	(5. palvelin)

closing socket '77'. 	23.1.2022 	15:19:51 	lx 	(5. palvelin)

*** tcp close for sock 77, type 'nil', protocol 'nil', reason: 'POLLHUP', request length: (no request) bytes ***. 	23.1.2022 	15:23:17 	lx 	(5. palvelin)

closing socket '77'. 	23.1.2022 	15:23:17 	lx 	(5. palvelin)

4D: SELECT inv.record_id FROM invoice inv WHERE inv.invoice_id <> '' INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv  WHERE inv.invoice_id <> ''  ORDER BY inv.invoice_id  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
 - result _lx_atExe1 size: 53111, first value: '1'
 - query name: new:form/nc/erp-sync/query/order-invoice.json. 	23.1.2022 	15:23:27 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 17, send result: -1, send count: 3, loop count: 3, bytes sent 244980 / 2809407, 2564427 remaining, total send time 41 µs. 	23.1.2022 	15:23:29 	lx 	(5. palvelin)

 -- tcp answer 17, send result: -1, send count: 4, loop count: 5, bytes sent 326640 / 2809407, 2482767 remaining, total send time 1295 µs. 	23.1.2022 	15:23:29 	lx 	(5. palvelin)

 -- tcp answer 17, send result: -1, send count: 6, loop count: 8, bytes sent 489960 / 2809407, 2319447 remaining, total send time 3127 µs. 	23.1.2022 	15:23:29 	lx 	(5. palvelin)

 -- tcp answer 17, send result: -1, send count: 7, loop count: 10, bytes sent 571620 / 2809407, 2237787 remaining, total send time 4371 µs. 	23.1.2022 	15:23:29 	lx 	(5. palvelin)

 -- tcp answer 17, send result: -1, send count: 10, loop count: 15, bytes sent 816600 / 2809407, 1992807 remaining, total send time 7560 µs. 	23.1.2022 	15:23:30 	lx 	(5. palvelin)

 -- tcp answer 17, send result: -1, send count: 12, loop count: 18, bytes sent 963588 / 2809407, 1845819 remaining, total send time 10002 µs. 	23.1.2022 	15:23:30 	lx 	(5. palvelin)

 -- tcp answer 17, send result: -1, send count: 13, loop count: 20, bytes sent 1045248 / 2809407, 1764159 remaining, total send time 11503 µs. 	23.1.2022 	15:23:30 	lx 	(5. palvelin)

error:  -- tcp answer 17, remaining bytes send failed with result code: -100, bytes sent: 1469880 / 2809407, total send time 13499 µs
  [stack traceback:
	/Users/pasi/nc/nc-server/lib/util.lua:546: in function 'printError'
	/Users/pasi/nc/nc-server/lib/lib_tcp.lua:318: in function 'send'
	/Users/pasi/nc/nc-server/lib/server.lua:141: in function 'answer'
	/Users/pasi/nc/nc-server/lib/server.lua:225: in function 'in_callback'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:248: in function 'poll_event'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:329: in function 'poll'
	/Users/pasi/nc/nc-server/lib/server.lua:312: in function 'pollLoop'
	/Users/pasi/nc/nc-server/nc/nc-server.lua:123: in function 'server'
	/Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:146: in function </Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:129>
	[C]: in function 'pcall'
	/Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:66: in function </Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:18>]
. 	23.1.2022 	15:23:30 	lx 	(5. palvelin)

error:  -- tcp answer 17, remaining bytes send failed with result code: -100, bytes sent: 1469880 / 2809407, total send time 13499 µs
  [stack traceback:
	/Users/pasi/nc/nc-server/lib/util.lua:546: in function 'printError'
	/Users/pasi/nc/nc-server/lib/lib_tcp.lua:318: in function 'send'
	/Users/pasi/nc/nc-server/lib/server.lua:141: in function 'answer'
	/Users/pasi/nc/nc-server/lib/server.lua:225: in function 'in_callback'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:248: in function 'poll_event'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:329: in function 'poll'
	/Users/pasi/nc/nc-server/lib/server.lua:312: in function 'pollLoop'
	/Users/pasi/nc/nc-server/nc/nc-server.lua:123: in function 'server'
	/Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:146: in function </Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:129>
	[C]: in function 'pcall'
	/Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:66: in function </Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:18>]. 	23.1.2022 	15:23:30 	_lx_SERVER 	(5. palvelin)

*** tcp close for sock 77, type 'nil', protocol 'HTTP', reason: 'POLLHUP', request length: 1 182 bytes ***. 	23.1.2022 	15:25:53 	lx 	(5. palvelin)

closing socket '77'. 	23.1.2022 	15:25:53 	lx 	(5. palvelin)

4D: SELECT inv.record_id FROM invoice inv WHERE inv.invoice_id <> '' INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv  WHERE inv.invoice_id <> ''  ORDER BY inv.invoice_id  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
 - result _lx_atExe1 size: 53111, first value: '1'
 - query name: new:form/nc/erp-sync/query/order-invoice.json. 	23.1.2022 	15:26:09 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 18, send result: -1, send count: 3, loop count: 3, bytes sent 244980 / 2809407, 2564427 remaining, total send time 9 µs. 	23.1.2022 	15:26:12 	lx 	(5. palvelin)

 -- tcp answer 18, send result: -1, send count: 4, loop count: 5, bytes sent 326640 / 2809407, 2482767 remaining, total send time 1547 µs. 	23.1.2022 	15:26:12 	lx 	(5. palvelin)

 -- tcp answer 18, send result: -1, send count: 5, loop count: 7, bytes sent 408300 / 2809407, 2401107 remaining, total send time 2785 µs. 	23.1.2022 	15:26:12 	lx 	(5. palvelin)

 -- tcp answer 18, send result: -1, send count: 6, loop count: 9, bytes sent 489960 / 2809407, 2319447 remaining, total send time 4032 µs. 	23.1.2022 	15:26:12 	lx 	(5. palvelin)

 -- tcp answer 18, send result: -1, send count: 9, loop count: 14, bytes sent 702276 / 2809407, 2107131 remaining, total send time 7099 µs. 	23.1.2022 	15:26:12 	lx 	(5. palvelin)

 -- tcp answer 18, send result: -1, send count: 10, loop count: 16, bytes sent 783936 / 2809407, 2025471 remaining, total send time 8345 µs. 	23.1.2022 	15:26:12 	lx 	(5. palvelin)

error:  -- tcp answer 18, remaining bytes send failed with result code: -100, bytes sent: 1208568 / 2809407, total send time 10519 µs
  [stack traceback:
	/Users/pasi/nc/nc-server/lib/util.lua:546: in function 'printError'
	/Users/pasi/nc/nc-server/lib/lib_tcp.lua:318: in function 'send'
	/Users/pasi/nc/nc-server/lib/server.lua:141: in function 'answer'
	/Users/pasi/nc/nc-server/lib/server.lua:225: in function 'in_callback'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:248: in function 'poll_event'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:329: in function 'poll'
	/Users/pasi/nc/nc-server/lib/server.lua:312: in function 'pollLoop'
	/Users/pasi/nc/nc-server/nc/nc-server.lua:123: in function 'server'
	/Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:146: in function </Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:129>
	[C]: in function 'pcall'
	/Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:66: in function </Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:18>]
. 	23.1.2022 	15:26:12 	lx 	(5. palvelin)

error:  -- tcp answer 18, remaining bytes send failed with result code: -100, bytes sent: 1208568 / 2809407, total send time 10519 µs
  [stack traceback:
	/Users/pasi/nc/nc-server/lib/util.lua:546: in function 'printError'
	/Users/pasi/nc/nc-server/lib/lib_tcp.lua:318: in function 'send'
	/Users/pasi/nc/nc-server/lib/server.lua:141: in function 'answer'
	/Users/pasi/nc/nc-server/lib/server.lua:225: in function 'in_callback'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:248: in function 'poll_event'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:329: in function 'poll'
	/Users/pasi/nc/nc-server/lib/server.lua:312: in function 'pollLoop'
	/Users/pasi/nc/nc-server/nc/nc-server.lua:123: in function 'server'
	/Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:146: in function </Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:129>
	[C]: in function 'pcall'
	/Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:66: in function </Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:18>]. 	23.1.2022 	15:26:12 	_lx_SERVER 	(5. palvelin)

*** tcp close for sock 77, type 'nil', protocol 'HTTP', reason: 'POLLHUP', request length: 1 178 bytes ***. 	23.1.2022 	15:26:38 	lx 	(5. palvelin)

closing socket '77'. 	23.1.2022 	15:26:38 	lx 	(5. palvelin)

4D: SELECT inv.record_id FROM invoice inv WHERE inv.invoice_id <> '' INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv  WHERE inv.invoice_id <> ''  ORDER BY inv.invoice_id  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
 - result _lx_atExe1 size: 53111, first value: '1'
 - query name: new:form/nc/erp-sync/query/order-invoice.json. 	23.1.2022 	15:26:49 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 19, send result: -1, send count: 10, loop count: 10, bytes sent 685944 / 2809407, 2123463 remaining, total send time 145 µs. 	23.1.2022 	15:26:51 	lx 	(5. palvelin)

 -- tcp answer 19, send result: -1, send count: 18, loop count: 20, bytes sent 1273896 / 2809407, 1535511 remaining, total send time 3174 µs. 	23.1.2022 	15:26:52 	lx 	(5. palvelin)

error:  -- tcp answer 19, remaining bytes send failed with result code: -100, bytes sent: 1665864 / 2809407, total send time 5523 µs
  [stack traceback:
	/Users/pasi/nc/nc-server/lib/util.lua:546: in function 'printError'
	/Users/pasi/nc/nc-server/lib/lib_tcp.lua:318: in function 'send'
	/Users/pasi/nc/nc-server/lib/server.lua:141: in function 'answer'
	/Users/pasi/nc/nc-server/lib/server.lua:225: in function 'in_callback'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:248: in function 'poll_event'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:329: in function 'poll'
	/Users/pasi/nc/nc-server/lib/server.lua:312: in function 'pollLoop'
	/Users/pasi/nc/nc-server/nc/nc-server.lua:123: in function 'server'
	/Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:146: in function </Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:129>
	[C]: in function 'pcall'
	/Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:66: in function </Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:18>]
. 	23.1.2022 	15:26:52 	lx 	(5. palvelin)

error:  -- tcp answer 19, remaining bytes send failed with result code: -100, bytes sent: 1665864 / 2809407, total send time 5523 µs
  [stack traceback:
	/Users/pasi/nc/nc-server/lib/util.lua:546: in function 'printError'
	/Users/pasi/nc/nc-server/lib/lib_tcp.lua:318: in function 'send'
	/Users/pasi/nc/nc-server/lib/server.lua:141: in function 'answer'
	/Users/pasi/nc/nc-server/lib/server.lua:225: in function 'in_callback'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:248: in function 'poll_event'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:329: in function 'poll'
	/Users/pasi/nc/nc-server/lib/server.lua:312: in function 'pollLoop'
	/Users/pasi/nc/nc-server/nc/nc-server.lua:123: in function 'server'
	/Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:146: in function </Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:129>
	[C]: in function 'pcall'
	/Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:66: in function </Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:18>]. 	23.1.2022 	15:26:52 	_lx_SERVER 	(5. palvelin)

*** tcp close for sock 77, type 'nil', protocol 'HTTP', reason: 'POLLHUP', request length: 1 179 bytes ***. 	23.1.2022 	15:27:02 	lx 	(5. palvelin)

closing socket '77'. 	23.1.2022 	15:27:02 	lx 	(5. palvelin)

Starting to stop tcp server 2, max. delay 1,7 seconds... 	23.1.2022 	15:27:08 	_lx_SERVER 	(6. tbl_ 5)

*** tcp close for sock 72, type 'nil', protocol 'nil', reason: '', request length: (no request) bytes ***. 	23.1.2022 	15:27:08 	lx 	(5. palvelin)

closing socket '72'. 	23.1.2022 	15:27:08 	lx 	(5. palvelin)

*** tcp close for sock 73, type 'nil', protocol 'nil', reason: '', request length: (no request) bytes ***. 	23.1.2022 	15:27:08 	lx 	(5. palvelin)

closing socket '73'. 	23.1.2022 	15:27:08 	lx 	(5. palvelin)

 -- Server statistics --
answerCount:          19
poll.fd_count:        0
pollCount:            62552
pollInCount:          29
pollOutCount:         0
pollCloseCount:       10
pollErrCount:         0
fd add/remove count:  12/12
totalBytesReceived:   29127
totalBytesSent:       366883. 	23.1.2022 	15:27:08 	lx 	(5. palvelin)

--- server stopped ---. 	23.1.2022 	15:27:08 	lx 	(5. palvelin)

finalizer: free p1 	 cdata<void *>: 0x013d6b1c90. 	23.1.2022 	15:27:08 	lx 	(5. palvelin)

Tcp palvelin 2 sammutettu. 	23.1.2022 	15:27:08 	_lx_SERVER 	(5. palvelin)

Tcp palvelin 2 ei ole käynnissä. 	23.1.2022 	15:27:42 	_lx_SERVER 	(6. tbl_ 5)

Käynnisteään Tcp palvelin 2. 	23.1.2022 	15:27:47 	_lx_SERVER 	(5. palvelin)

* run in command line: 'LC_ALL=C ifconfig en0 | awk '/ether/{print $2}''. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/table/db_connection_preference.json'. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/preference/auth/connection.json'. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/.nc-env.json'. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

    Connected to: 'postgre local socket, /tmp, database: fi_demo, user: manage_demo'. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

  database connect time: 0.0003 seconds. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

* connect: connection changed to 'postgre-demo/fi_demo'. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

* paths:
 - main: '/Users/pasi/nc/nc-server/'
 - bin : '/Users/pasi/4D/mg_v19/Manageri_v19/Resources/bin/bin_osx_arm64/'
 - pref: '/Users/pasi/nc/nc-server/preference/'
 - 4D  : '/Users/pasi/4D/mg_v19/Manageri_v19/'
. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/preference/table/prf/group.json'. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

poll.expand_fds: 50, old fds: nil, new fds: cdata<struct pollfd *>: 0x013cd48ef0, size: 400. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

********************* /Users/pasi/nc/nc-server/ *********************. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

port: 5949, arguments: '[
	5949
]', nc-server.json: '[]'. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

nc_server: debugLevel(0):0  port(5959):5949  closeConnection(0):0. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

1. Loading plugin: nc/worker/auth_worker. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

2. Loading plugin: nc/worker/query_worker. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

3. Loading plugin: nc/worker/query4d_worker. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

4. Loading plugin: nc/worker/call4d_worker. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

All plugins have been loaded. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

* cached preference files: demo-fi_demo-0 - system/4d.json, demo-fi_demo-0 - table/prf/field_type.json, demo-fi_demo-0 - system/option.json. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

* run in command line: 'ifconfig | grep -E 'inet.[0-9]' | grep -v '127.0.0.1' | awk '{ print $2}''. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

* run in command line: 'LC_ALL=C ifconfig en0 | awk '/ether/{print $2}''. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

Mac address: f84d896921dc. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

TLS certificate files: /Users/pasi/nc/nc-server/preference/cert/cert.pem, /Users/pasi/nc/nc-server/preference/cert/privkey.pem. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

NC tcp server waiting on:  http://127.0.0.1:5949/,  http://192.168.32.2:5949/
                          https://127.0.0.1:5949/, https://192.168.32.2:5949/. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

NC udp server waiting on: 127.0.0.1:5949/, 192.168.32.2:5949/. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

--- server started in 0.0023 seconds, 2022-01-23 15:27:49, used memory 3098.5 kb --- 	 5. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

OSX arm64, using: rapidjson-arm, lfs-ffi. 	23.1.2022 	15:27:49 	lx 	(5. palvelin)

1. uri: HTTP, POST '/rest/nc/query/sql4d' 2022-01-23 15:27:59
'POST /rest/nc/query/sql4d HTTP/1.1
Content-Type: application/json
Connection: keep-alive
User-Agent: nc-rest-sql
Authorization: Basic ???
Content-Encoding: lz4
Accept-Encoding: lz4
Content-Length: 911
Content-Uncompressed-Length: 1423

LZ4. 	23.1.2022 	15:27:59 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/.nc-env.json'. 	23.1.2022 	15:27:59 	lx 	(5. palvelin)

    Connected to: 'Manageri v12 plg4d local, , database: plg4d, user: manage_demo'. 	23.1.2022 	15:27:59 	lx 	(5. palvelin)

  database connect time: 0.0001 seconds. 	23.1.2022 	15:27:59 	lx 	(5. palvelin)

* connect: connection changed from 'postgre-demo/fi_demo' to 'plg4d/plg4d'. 	23.1.2022 	15:27:59 	lx 	(5. palvelin)

4D: SELECT inv.record_id FROM invoice inv WHERE inv.invoice_id <> '' INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv  WHERE inv.invoice_id <> ''  ORDER BY inv.invoice_id  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
 - result _lx_atExe1 size: 53111, first value: '1'
 - query name: new:form/nc/erp-sync/query/order-invoice.json. 	23.1.2022 	15:28:00 	_lx_ExecuteSqlNew 	(5. palvelin)

 1. answer time: 00:00:00.09013
  
SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id
 FROM invoice inv
 WHERE inv.invoice_id <> ''
 ORDER BY inv.invoice_id. 	23.1.2022 	15:28:03 	lx 	(5. palvelin)

 -- tcp answer 1, send result: -1, send count: 5, loop count: 5, bytes sent 408300 / 2738460, 2330160 remaining, total send time 21 µs. 	23.1.2022 	15:28:03 	lx 	(5. palvelin)

 -- tcp answer 1, send result: -1, send count: 6, loop count: 7, bytes sent 489960 / 2738460, 2248500 remaining, total send time 1281 µs. 	23.1.2022 	15:28:03 	lx 	(5. palvelin)

 -- tcp answer 1, send result: -1, send count: 7, loop count: 9, bytes sent 571620 / 2738460, 2166840 remaining, total send time 2610 µs. 	23.1.2022 	15:28:03 	lx 	(5. palvelin)

 -- tcp answer 1, send result: -1, send count: 14, loop count: 18, bytes sent 1077912 / 2738460, 1660548 remaining, total send time 5332 µs. 	23.1.2022 	15:28:03 	lx 	(5. palvelin)

 -- tcp answer 1, send result: -1, send count: 15, loop count: 20, bytes sent 1159572 / 2738460, 1578888 remaining, total send time 6745 µs. 	23.1.2022 	15:28:03 	lx 	(5. palvelin)

error:  -- tcp answer 1, remaining bytes send failed with result code: -100, bytes sent: 1698528 / 2738460, total send time 8311 µs
  [stack traceback:
	/Users/pasi/nc/nc-server/lib/util.lua:546: in function 'printError'
	/Users/pasi/nc/nc-server/lib/lib_tcp.lua:318: in function 'send'
	/Users/pasi/nc/nc-server/lib/server.lua:141: in function 'answer'
	/Users/pasi/nc/nc-server/lib/server.lua:225: in function 'in_callback'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:248: in function 'poll_event'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:329: in function 'poll'
	/Users/pasi/nc/nc-server/lib/server.lua:312: in function 'pollLoop'
	/Users/pasi/nc/nc-server/nc/nc-server.lua:123: in function 'server'
	/Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:146: in function </Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:129>
	[C]: in function 'pcall'
	/Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:66: in function </Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:18>]
. 	23.1.2022 	15:28:03 	lx 	(5. palvelin)

error:  -- tcp answer 1, remaining bytes send failed with result code: -100, bytes sent: 1698528 / 2738460, total send time 8311 µs
  [stack traceback:
	/Users/pasi/nc/nc-server/lib/util.lua:546: in function 'printError'
	/Users/pasi/nc/nc-server/lib/lib_tcp.lua:318: in function 'send'
	/Users/pasi/nc/nc-server/lib/server.lua:141: in function 'answer'
	/Users/pasi/nc/nc-server/lib/server.lua:225: in function 'in_callback'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:248: in function 'poll_event'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:329: in function 'poll'
	/Users/pasi/nc/nc-server/lib/server.lua:312: in function 'pollLoop'
	/Users/pasi/nc/nc-server/nc/nc-server.lua:123: in function 'server'
	/Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:146: in function </Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:129>
	[C]: in function 'pcall'
	/Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:66: in function </Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:18>]. 	23.1.2022 	15:28:03 	_lx_SERVER 	(5. palvelin)

Starting to stop tcp server 2, max. delay 1,7 seconds... 	23.1.2022 	15:28:29 	_lx_SERVER 	(6. tbl_ 5)

*** tcp close for sock 73, type 'nil', protocol 'nil', reason: '', request length: (no request) bytes ***. 	23.1.2022 	15:28:29 	lx 	(5. palvelin)

closing socket '73'. 	23.1.2022 	15:28:29 	lx 	(5. palvelin)

*** tcp close for sock 77, type 'nil', protocol 'nil', reason: '', request length: (no request) bytes ***. 	23.1.2022 	15:28:29 	lx 	(5. palvelin)

closing socket '77'. 	23.1.2022 	15:28:29 	lx 	(5. palvelin)

 -- Server statistics --
answerCount:          1
poll.fd_count:        1
pollCount:            1616
pollInCount:          2
pollOutCount:         0
pollCloseCount:       0
pollErrCount:         0
fd add/remove count:  3/2
totalBytesReceived:   1182
totalBytesSent:       0. 	23.1.2022 	15:28:29 	lx 	(5. palvelin)

warning: socket type 'number' is not a table, socket number: 78
. 	23.1.2022 	15:28:29 	lx 	(5. palvelin)

closing socket '78'. 	23.1.2022 	15:28:29 	lx 	(5. palvelin)

poll.expand_fds, free old fds: cdata<struct pollfd *>: 0x013cd48ef0. 	23.1.2022 	15:28:29 	lx 	(5. palvelin)

poll.expand_fds: 50, old fds: nil, new fds: cdata<struct pollfd *>: 0x013cd48ef0, size: 400. 	23.1.2022 	15:28:29 	lx 	(5. palvelin)

--- server stopped ---. 	23.1.2022 	15:28:29 	lx 	(5. palvelin)

finalizer: free p1 	 cdata<void *>: 0x013cd48ef0. 	23.1.2022 	15:28:29 	lx 	(5. palvelin)

Tcp palvelin 2 sammutettu. 	23.1.2022 	15:28:29 	_lx_SERVER 	(5. palvelin)

Käynnisteään Tcp palvelin 2. 	23.1.2022 	16:14:19 	_lx_SERVER 	(9. palvelin)

* run in command line: 'LC_ALL=C ifconfig en0 | awk '/ether/{print $2}''. 	23.1.2022 	16:14:20 	lx 	(9. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/table/db_connection_preference.json'. 	23.1.2022 	16:14:20 	lx 	(9. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/preference/auth/connection.json'. 	23.1.2022 	16:14:20 	lx 	(9. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/.nc-env.json'. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

    Connected to: 'postgre local socket, /tmp, database: fi_demo, user: manage_demo'. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

  database connect time: 0.0005 seconds. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

* connect: connection changed to 'postgre-demo/fi_demo'. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

* paths:
 - main: '/Users/pasi/nc/nc-server/'
 - bin : '/Users/pasi/4D/mg_v19/Manageri_v19/Resources/bin/bin_osx_arm64/'
 - pref: '/Users/pasi/nc/nc-server/preference/'
 - 4D  : '/Users/pasi/4D/mg_v19/Manageri_v19/'
. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/preference/table/prf/group.json'. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

poll.expand_fds: 50, old fds: nil, new fds: cdata<struct pollfd *>: 0x014ca999e0, size: 400. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

********************* /Users/pasi/nc/nc-server/ *********************. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

port: 5949, arguments: '[
	5949
]', nc-server.json: '[]'. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

nc_server: debugLevel(0):0  port(5959):5949  closeConnection(0):0. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

1. Loading plugin: nc/worker/auth_worker. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

2. Loading plugin: nc/worker/query_worker. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

3. Loading plugin: nc/worker/query4d_worker. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

4. Loading plugin: nc/worker/call4d_worker. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

All plugins have been loaded. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

* cached preference files: demo-fi_demo-0 - system/4d.json, demo-fi_demo-0 - system/option.json, demo-fi_demo-0 - table/prf/field_type.json. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

* run in command line: 'ifconfig | grep -E 'inet.[0-9]' | grep -v '127.0.0.1' | awk '{ print $2}''. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

* run in command line: 'LC_ALL=C ifconfig en0 | awk '/ether/{print $2}''. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

Mac address: f84d896921dc. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

TLS certificate files: /Users/pasi/nc/nc-server/preference/cert/cert.pem, /Users/pasi/nc/nc-server/preference/cert/privkey.pem. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

NC tcp server waiting on:  http://127.0.0.1:5949/,  http://192.168.32.2:5949/
                          https://127.0.0.1:5949/, https://192.168.32.2:5949/. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

NC udp server waiting on: 127.0.0.1:5949/, 192.168.32.2:5949/. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

--- server started in 0.0025 seconds, 2022-01-23 16:14:21, used memory 3000.7 kb --- 	 5. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

OSX arm64, using: rapidjson-arm, lfs-ffi. 	23.1.2022 	16:14:21 	lx 	(9. palvelin)

1. uri: HTTP, POST '/rest/nc/query/sql4d' 2022-01-23 16:14:59
'POST /rest/nc/query/sql4d HTTP/1.1
Content-Type: application/json
Connection: keep-alive
User-Agent: nc-rest-sql
Authorization: Basic ???
Content-Encoding: lz4
Accept-Encoding: lz4
Content-Length: 815
Content-Uncompressed-Length: 1188

LZ4. 	23.1.2022 	16:14:59 	lx 	(9. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/.nc-env.json'. 	23.1.2022 	16:14:59 	lx 	(9. palvelin)

    Connected to: 'Manageri v12 plg4d local, , database: plg4d, user: manage_demo'. 	23.1.2022 	16:14:59 	lx 	(9. palvelin)

  database connect time: 0.0002 seconds. 	23.1.2022 	16:14:59 	lx 	(9. palvelin)

* connect: connection changed from 'postgre-demo/fi_demo' to 'plg4d/plg4d'. 	23.1.2022 	16:14:59 	lx 	(9. palvelin)

4D: SELECT so.record_id FROM sales_order so WHERE so.project_id <> '' LIMIT 500 INTO :_lx_atExe1
 - original query: SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id FROM sales_order so  WHERE so.project_id <> ''  ORDER BY so.sales_order_id DESC  LIMIT 500  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8
 - result _lx_atExe1 size: 500, first value: '2001066'
 - query name: new:form/nc/erp-sync/woocommerce/query-local/order-sales.json. 	23.1.2022 	16:15:00 	_lx_ExecuteSqlNew 	(9. palvelin)

 1. answer time: 00:00:00.02494
  
SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id
 FROM sales_order so
 WHERE so.project_id <> ''
 ORDER BY so.sales_order_id DESC
 LIMIT 500. 	23.1.2022 	16:15:00 	lx 	(9. palvelin)

 -- tcp answer 1, send count: 5, loop count: 4, bytes sent 341310 / 341310, 0 remaining, total send time 56 µs. 	23.1.2022 	16:15:00 	lx 	(9. palvelin)

4D: SELECT inv.record_id FROM invoice inv WHERE inv.invoice_id <> '' INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv  WHERE inv.invoice_id <> ''  ORDER BY inv.invoice_id  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
 - result _lx_atExe1 size: 53111, first value: '1'
 - query name: new:form/nc/erp-sync/query/order-invoice.json. 	23.1.2022 	16:15:20 	_lx_ExecuteSqlNew 	(9. palvelin)

 -- tcp answer 2, send result: -1, send count: 8, loop count: 8, bytes sent 587952 / 2717019, 2129067 remaining, total send time 169 µs. 	23.1.2022 	16:15:23 	lx 	(9. palvelin)

 -- tcp answer 2, send result: -1, send count: 9, loop count: 10, bytes sent 669612 / 2717019, 2047407 remaining, total send time 1427 µs. 	23.1.2022 	16:15:23 	lx 	(9. palvelin)

 -- tcp answer 2, send result: -1, send count: 16, loop count: 19, bytes sent 1175904 / 2717019, 1541115 remaining, total send time 3914 µs. 	23.1.2022 	16:15:23 	lx 	(9. palvelin)

 -- tcp answer 2, send result: -1, send count: 17, loop count: 21, bytes sent 1257564 / 2717019, 1459455 remaining, total send time 5407 µs. 	23.1.2022 	16:15:23 	lx 	(9. palvelin)

error:  -- tcp answer 2, remaining bytes send failed with result code: -100, bytes sent: 1339224 / 2717019, total send time 6674 µs
  [stack traceback:
	/Users/pasi/nc/nc-server/lib/util.lua:546: in function 'printError'
	/Users/pasi/nc/nc-server/lib/lib_tcp.lua:318: in function 'send'
	/Users/pasi/nc/nc-server/lib/server.lua:141: in function 'answer'
	/Users/pasi/nc/nc-server/lib/server.lua:225: in function 'in_callback'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:248: in function 'poll_event'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:329: in function 'poll'
	/Users/pasi/nc/nc-server/lib/server.lua:312: in function 'pollLoop'
	/Users/pasi/nc/nc-server/nc/nc-server.lua:123: in function 'server'
	/Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:146: in function </Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:129>
	[C]: in function 'pcall'
	/Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:66: in function </Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:18>]
. 	23.1.2022 	16:15:23 	lx 	(9. palvelin)

error:  -- tcp answer 2, remaining bytes send failed with result code: -100, bytes sent: 1339224 / 2717019, total send time 6674 µs
  [stack traceback:
	/Users/pasi/nc/nc-server/lib/util.lua:546: in function 'printError'
	/Users/pasi/nc/nc-server/lib/lib_tcp.lua:318: in function 'send'
	/Users/pasi/nc/nc-server/lib/server.lua:141: in function 'answer'
	/Users/pasi/nc/nc-server/lib/server.lua:225: in function 'in_callback'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:248: in function 'poll_event'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:329: in function 'poll'
	/Users/pasi/nc/nc-server/lib/server.lua:312: in function 'pollLoop'
	/Users/pasi/nc/nc-server/nc/nc-server.lua:123: in function 'server'
	/Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:146: in function </Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:129>
	[C]: in function 'pcall'
	/Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:66: in function </Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:18>]. 	23.1.2022 	16:15:24 	_lx_SERVER 	(9. palvelin)

*** tcp close for sock 79, type 'nil', protocol 'HTTP', reason: 'POLLHUP', request length: 1 181 bytes ***. 	23.1.2022 	16:17:21 	lx 	(9. palvelin)

closing socket '79'. 	23.1.2022 	16:17:21 	lx 	(9. palvelin)

Starting to stop tcp server 2, max. delay 1,7 seconds... 	23.1.2022 	16:17:57 	_lx_SERVER 	(5. tbl_ 7)

*** tcp close for sock 77, type 'nil', protocol 'nil', reason: '', request length: (no request) bytes ***. 	23.1.2022 	16:17:57 	lx 	(9. palvelin)

closing socket '77'. 	23.1.2022 	16:17:57 	lx 	(9. palvelin)

*** tcp close for sock 78, type 'nil', protocol 'nil', reason: '', request length: (no request) bytes ***. 	23.1.2022 	16:17:57 	lx 	(9. palvelin)

closing socket '78'. 	23.1.2022 	16:17:57 	lx 	(9. palvelin)

 -- Server statistics --
answerCount:          2
poll.fd_count:        0
pollCount:            9384
pollInCount:          3
pollOutCount:         0
pollCloseCount:       1
pollErrCount:         0
fd add/remove count:  3/3
totalBytesReceived:   2267
totalBytesSent:       81660. 	23.1.2022 	16:17:57 	lx 	(9. palvelin)

--- server stopped ---. 	23.1.2022 	16:17:57 	lx 	(9. palvelin)

finalizer: free p1 	 cdata<void *>: 0x014ca999e0. 	23.1.2022 	16:17:57 	lx 	(9. palvelin)

Tcp palvelin 2 sammutettu. 	23.1.2022 	16:17:57 	_lx_SERVER 	(9. palvelin)

Aluetta ei löytynyt: 268435458. 	23.1.2022 	16:18:35 	_alp SEL_GET 	(9. Preference)

Aluetta ei löytynyt. 	23.1.2022 	16:18:35 	_alp ArrSize 	(9. Preference)

* run in command line: 'LC_ALL=C ifconfig en0 | awk '/ether/{print $2}''. 	23.1.2022 	16:18:52 	lx 	(1. Application process)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/table/db_connection_preference.json'. 	23.1.2022 	16:18:52 	lx 	(1. Application process)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/preference/auth/connection.json'. 	23.1.2022 	16:18:52 	lx 	(1. Application process)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/.nc-env.json'. 	23.1.2022 	16:18:52 	lx 	(1. Application process)

    Connected to: 'postgre local socket, /tmp, database: fi_demo, user: manage_demo'. 	23.1.2022 	16:18:52 	lx 	(1. Application process)

  database connect time: 0.0003 seconds. 	23.1.2022 	16:18:52 	lx 	(1. Application process)

* connect: connection changed to 'postgre-demo/fi_demo'. 	23.1.2022 	16:18:52 	lx 	(1. Application process)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/preference/table/prf/group.json'. 	23.1.2022 	16:18:52 	lx 	(1. Application process)

* preference 'system/nc_server_start.json' was loaded from database 'postgre local socket, /tmp, database: fi_demo, user: manage_demo'. 	23.1.2022 	16:18:52 	lx 	(1. Application process)

Käynnisteään Tcp palvelin 2. 	23.1.2022 	16:18:52 	_lx_SERVER 	(5. palvelin)

* run in command line: 'LC_ALL=C ifconfig en0 | awk '/ether/{print $2}''. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/table/db_connection_preference.json'. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/preference/auth/connection.json'. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/.nc-env.json'. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

    Connected to: 'postgre local socket, /tmp, database: fi_demo, user: manage_demo'. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

  database connect time: 0.0003 seconds. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

* connect: connection changed to 'postgre-demo/fi_demo'. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

* paths:
 - main: '/Users/pasi/nc/nc-server/'
 - bin : '/Users/pasi/4D/mg_v19/Manageri_v19/Resources/bin/bin_osx_arm64/'
 - pref: '/Users/pasi/nc/nc-server/preference/'
 - 4D  : '/Users/pasi/4D/mg_v19/Manageri_v19/'
. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/preference/table/prf/group.json'. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

poll.expand_fds: 50, old fds: nil, new fds: cdata<struct pollfd *>: 0x012e64b750, size: 400. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

********************* /Users/pasi/nc/nc-server/ *********************. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

port: 5949, arguments: '[
	5949
]', nc-server.json: '[]'. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

nc_server: debugLevel(0):0  port(5959):5949  closeConnection(0):0. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

1. Loading plugin: nc/worker/auth_worker. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

2. Loading plugin: nc/worker/query_worker. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

3. Loading plugin: nc/worker/query4d_worker. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

4. Loading plugin: nc/worker/call4d_worker. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

All plugins have been loaded. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

* cached preference files: demo-fi_demo-0 - system/option.json, demo-fi_demo-0 - system/4d.json, demo-fi_demo-0 - table/prf/field_type.json. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

* run in command line: 'ifconfig | grep -E 'inet.[0-9]' | grep -v '127.0.0.1' | awk '{ print $2}''. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

* run in command line: 'LC_ALL=C ifconfig en0 | awk '/ether/{print $2}''. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

Mac address: f84d896921dc. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

TLS certificate files: /Users/pasi/nc/nc-server/preference/cert/cert.pem, /Users/pasi/nc/nc-server/preference/cert/privkey.pem. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

NC tcp server waiting on:  http://127.0.0.1:5949/,  http://192.168.32.2:5949/
                          https://127.0.0.1:5949/, https://192.168.32.2:5949/. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

NC udp server waiting on: 127.0.0.1:5949/, 192.168.32.2:5949/. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

--- server started in 0.0024 seconds, 2022-01-23 16:18:54, used memory 3000.7 kb --- 	 5. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

OSX arm64, using: rapidjson-arm, lfs-ffi. 	23.1.2022 	16:18:54 	lx 	(5. palvelin)

1. uri: HTTP, POST '/rest/nc/query/sql4d' 2022-01-23 16:19:24
'POST /rest/nc/query/sql4d HTTP/1.1
Content-Type: application/json
Connection: keep-alive
User-Agent: nc-rest-sql
Authorization: Basic ???
Content-Encoding: lz4
Accept-Encoding: lz4
Content-Length: 923
Content-Uncompressed-Length: 1423

LZ4. 	23.1.2022 	16:19:24 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/.nc-env.json'. 	23.1.2022 	16:19:24 	lx 	(5. palvelin)

    Connected to: 'Manageri v12 plg4d local, , database: plg4d, user: manage_demo'. 	23.1.2022 	16:19:24 	lx 	(5. palvelin)

  database connect time: 0.0001 seconds. 	23.1.2022 	16:19:24 	lx 	(5. palvelin)

* connect: connection changed from 'postgre-demo/fi_demo' to 'plg4d/plg4d'. 	23.1.2022 	16:19:24 	lx 	(5. palvelin)

4D: SELECT inv.record_id FROM invoice inv WHERE inv.invoice_id <> '' INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv  WHERE inv.invoice_id <> ''  ORDER BY inv.invoice_id  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
 - result _lx_atExe1 size: 53111, first value: '1'
 - query name: new:form/nc/erp-sync/query/order-invoice.json. 	23.1.2022 	16:19:25 	_lx_ExecuteSqlNew 	(5. palvelin)

 1. answer time: 00:00:00.26822
  
SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id
 FROM invoice inv
 WHERE inv.invoice_id <> ''
 ORDER BY inv.invoice_id. 	23.1.2022 	16:19:35 	lx 	(5. palvelin)

 -- tcp answer 1, send result: -1, send count: 2, loop count: 2, bytes sent 163320 / 2747743, 2584423 remaining, total send time 24 µs. 	23.1.2022 	16:19:35 	lx 	(5. palvelin)

 -- tcp answer 1, send result: -1, send count: 3, loop count: 4, bytes sent 244980 / 2747743, 2502763 remaining, total send time 1276 µs. 	23.1.2022 	16:19:35 	lx 	(5. palvelin)

 -- tcp answer 1, send result: -1, send count: 10, loop count: 13, bytes sent 767604 / 2747743, 1980139 remaining, total send time 3810 µs. 	23.1.2022 	16:19:35 	lx 	(5. palvelin)

 -- tcp answer 1, send result: -1, send count: 17, loop count: 21, bytes sent 1273896 / 2747743, 1473847 remaining, total send time 5157 µs. 	23.1.2022 	16:19:35 	lx 	(5. palvelin)

error:  -- tcp answer 1, remaining bytes send failed with result code: -100, bytes sent: 1355556 / 2747743, total send time 6416 µs
  [stack traceback:
	/Users/pasi/nc/nc-server/lib/util.lua:546: in function 'printError'
	/Users/pasi/nc/nc-server/lib/lib_tcp.lua:320: in function 'send'
	/Users/pasi/nc/nc-server/lib/server.lua:141: in function 'answer'
	/Users/pasi/nc/nc-server/lib/server.lua:225: in function 'in_callback'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:248: in function 'poll_event'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:329: in function 'poll'
	/Users/pasi/nc/nc-server/lib/server.lua:312: in function 'pollLoop'
	/Users/pasi/nc/nc-server/nc/nc-server.lua:123: in function 'server'
	/Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:146: in function </Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:129>
	[C]: in function 'pcall'
	/Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:66: in function </Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:18>]
. 	23.1.2022 	16:19:35 	lx 	(5. palvelin)

error:  -- tcp answer 1, remaining bytes send failed with result code: -100, bytes sent: 1355556 / 2747743, total send time 6416 µs
  [stack traceback:
	/Users/pasi/nc/nc-server/lib/util.lua:546: in function 'printError'
	/Users/pasi/nc/nc-server/lib/lib_tcp.lua:320: in function 'send'
	/Users/pasi/nc/nc-server/lib/server.lua:141: in function 'answer'
	/Users/pasi/nc/nc-server/lib/server.lua:225: in function 'in_callback'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:248: in function 'poll_event'
	/Users/pasi/nc/nc-server/lib/lib_poll.lua:329: in function 'poll'
	/Users/pasi/nc/nc-server/lib/server.lua:312: in function 'pollLoop'
	/Users/pasi/nc/nc-server/nc/nc-server.lua:123: in function 'server'
	/Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:146: in function </Users/pasi/nc/nc-server/manager/4d/nc_server_4d.lua:129>
	[C]: in function 'pcall'
	/Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:66: in function </Users/pasi/nc/nc-server/manager/4d/run_from_4d.lua:18>]. 	23.1.2022 	16:19:35 	_lx_SERVER 	(5. palvelin)

*** tcp close for sock 77, type 'nil', protocol 'HTTP', reason: 'POLLHUP', request length: 1 194 bytes ***. 	23.1.2022 	16:19:47 	lx 	(5. palvelin)

closing socket '77'. 	23.1.2022 	16:19:47 	lx 	(5. palvelin)

SELECT inv.record_id FROM invoice inv WHERE ord.company_id = '1057' INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv  WHERE ord.company_id = '1057'  ORDER BY inv.invoice_id  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
 - result _lx_atExe1 size: 0
 - query name: new:form/nc/erp-sync/query/order-invoice.json. 	23.1.2022 	16:22:33 	_lx_ExecuteSqlNew 	(5. palvelin)

sql: Error 0, Table 'ORD' is not declared in the FROM clause. (SQLS 1103)
Failed to validate column 'COMPANY_ID'. (SQLS 1717)
Failed to validate COMPARISON predicate. (SQLS 1708)
Failed to validate WHERE clause. (SQLS 1705)
Failed to validate SELECT command. (SQLS 1726)
Table 'ORD' is not declared in the FROM clause.Failed to validate SELECT command. (SQLS 1103)

SELECT inv.record_id FROM invoice inv WHERE ord.company_id = '1057' INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv
 WHERE ord.company_id = '1057'
 ORDER BY inv.invoice_id
 INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
'
SELECT inv.record_id FROM invoice inv WHERE ord.company_id = '1057' INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv
 WHERE ord.company_id = '1057'
 ORDER BY inv.invoice_id
 INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
'
 	23.1.2022 	16:22:33 	_lx_ExecuteSqlNew 	(5. palvelin)

4d execute sql error -1: Error 0, Table 'ORD' is not declared in the FROM clause. (SQLS 1103)
Failed to validate column 'COMPANY_ID'. (SQLS 1717)
Failed to validate COMPARISON predicate. (SQLS 1708)
Failed to validate WHERE clause. (SQLS 1705)
Failed to validate SELECT command. (SQLS 1726)
Table 'ORD' is not declared in the FROM clause.Failed to validate SELECT command. (SQLS 1103)

SELECT inv.record_id FROM invoice inv WHERE ord.company_id = '1057' INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv
 WHERE ord.company_id = '1057'
 ORDER BY inv.invoice_id
 INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9. 	23.1.2022 	16:22:33 	_lx_SERVER 	(5. palvelin)

SELECT inv.record_id FROM invoice inv WHERE ord.company_id = '1057' INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv  WHERE ord.company_id = '1057'  ORDER BY inv.invoice_id  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
 - result _lx_atExe1 size: 0
 - query name: new:form/nc/erp-sync/query/order-invoice.json. 	23.1.2022 	16:22:39 	_lx_ExecuteSqlNew 	(5. palvelin)

sql: Error 0, Table 'ORD' is not declared in the FROM clause. (SQLS 1103)
Failed to validate column 'COMPANY_ID'. (SQLS 1717)
Failed to validate COMPARISON predicate. (SQLS 1708)
Failed to validate WHERE clause. (SQLS 1705)
Failed to validate SELECT command. (SQLS 1726)
Table 'ORD' is not declared in the FROM clause.Failed to validate SELECT command. (SQLS 1103)

SELECT inv.record_id FROM invoice inv WHERE ord.company_id = '1057' INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv
 WHERE ord.company_id = '1057'
 ORDER BY inv.invoice_id
 INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
'
SELECT inv.record_id FROM invoice inv WHERE ord.company_id = '1057' INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv
 WHERE ord.company_id = '1057'
 ORDER BY inv.invoice_id
 INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
'
 	23.1.2022 	16:22:39 	_lx_ExecuteSqlNew 	(5. palvelin)

SELECT inv.record_id FROM invoice inv WHERE ord.company_id = '1057' INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv  WHERE ord.company_id = '1057'  ORDER BY inv.invoice_id  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
 - result _lx_atExe1 size: 0
 - query name: new:form/nc/erp-sync/query/order-invoice.json. 	23.1.2022 	16:22:40 	_lx_ExecuteSqlNew 	(5. palvelin)

sql: Error 0, Table 'ORD' is not declared in the FROM clause. (SQLS 1103)
Failed to validate column 'COMPANY_ID'. (SQLS 1717)
Failed to validate COMPARISON predicate. (SQLS 1708)
Failed to validate WHERE clause. (SQLS 1705)
Failed to validate SELECT command. (SQLS 1726)
Table 'ORD' is not declared in the FROM clause.Failed to validate SELECT command. (SQLS 1103)

SELECT inv.record_id FROM invoice inv WHERE ord.company_id = '1057' INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv
 WHERE ord.company_id = '1057'
 ORDER BY inv.invoice_id
 INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
'
SELECT inv.record_id FROM invoice inv WHERE ord.company_id = '1057' INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv
 WHERE ord.company_id = '1057'
 ORDER BY inv.invoice_id
 INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
'
 	23.1.2022 	16:22:40 	_lx_ExecuteSqlNew 	(5. palvelin)

SELECT inv.record_id FROM invoice inv WHERE ord.company_id = '1057' INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv  WHERE ord.company_id = '1057'  ORDER BY inv.invoice_id  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
 - result _lx_atExe1 size: 0
 - query name: new:form/nc/erp-sync/query/order-invoice.json. 	23.1.2022 	16:22:40 	_lx_ExecuteSqlNew 	(5. palvelin)

sql: Error 0, Table 'ORD' is not declared in the FROM clause. (SQLS 1103)
Failed to validate column 'COMPANY_ID'. (SQLS 1717)
Failed to validate COMPARISON predicate. (SQLS 1708)
Failed to validate WHERE clause. (SQLS 1705)
Failed to validate SELECT command. (SQLS 1726)
Table 'ORD' is not declared in the FROM clause.Failed to validate SELECT command. (SQLS 1103)

SELECT inv.record_id FROM invoice inv WHERE ord.company_id = '1057' INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv
 WHERE ord.company_id = '1057'
 ORDER BY inv.invoice_id
 INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
'
SELECT inv.record_id FROM invoice inv WHERE ord.company_id = '1057' INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv
 WHERE ord.company_id = '1057'
 ORDER BY inv.invoice_id
 INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
'
 	23.1.2022 	16:22:40 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT inv.record_id FROM invoice inv WHERE inv.company_id = '1057' INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv  WHERE inv.company_id = '1057'  ORDER BY inv.invoice_id  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
 - result _lx_atExe1 size: 127, first value: '1300969'
 - query name: new:form/nc/erp-sync/query/order-invoice.json. 	23.1.2022 	16:23:39 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT inr.record_id FROM invoice_row inr LEFT OUTER JOIN invoice inv ON inv.invoice_id = inr.invoice_id WHERE inv.record_id LIKE '20130531.143421.0f00o.in\_ zzy0001b6394d3d809' ESCAPE '\' INTO :_lx_atExe1
 - original query: SELECT inr.invoice_id, inr.row_number, inr.product_id, pr.transfer_id, inr.explanation, inr.delivered_quantity, inr.price__unit, inr.price_total, inr.vat_price, inr.record_id FROM invoice_row inr  LEFT OUTER JOIN product pr ON pr.product_id = inr.product_id  LEFT OUTER JOIN invoice inv ON inv.invoice_id = inr.invoice_id  WHERE inv.record_id LIKE '20130531.143421.0f00o.in\_  zzy0001b6394d3d809' ESCAPE '\'  ORDER BY inr.row_number  INTO :_lx_atExe1,:_lx_alExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_arExe3,:_lx_arExe4,:_lx_atExe5
 - result _lx_atExe1 size: 0
 - query name: new:form/nc/erp-sync/moloni/query-local/order_row-invoice.json. 	23.1.2022 	16:23:42 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT inr.record_id FROM invoice_row inr LEFT OUTER JOIN invoice inv ON inv.invoice_id = inr.invoice_id WHERE inv.record_id LIKE '20130531.143421.0f00o.in\_ zzy0001b6394d3d809' ESCAPE '\' INTO :_lx_atExe1
 - original query: SELECT inr.invoice_id, inr.row_number, inr.product_id, pr.transfer_id, inr.explanation, inr.delivered_quantity, inr.price__unit, inr.price_total, inr.vat_price, inr.record_id FROM invoice_row inr  LEFT OUTER JOIN product pr ON pr.product_id = inr.product_id  LEFT OUTER JOIN invoice inv ON inv.invoice_id = inr.invoice_id  WHERE inv.record_id LIKE '20130531.143421.0f00o.in\_  zzy0001b6394d3d809' ESCAPE '\'  ORDER BY inr.row_number  INTO :_lx_atExe1,:_lx_alExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_arExe3,:_lx_arExe4,:_lx_atExe5
 - result _lx_atExe1 size: 0
 - query name: new:form/nc/erp-sync/moloni/query-local/order_row-invoice.json. 	23.1.2022 	16:23:44 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT inr.record_id FROM invoice_row inr LEFT OUTER JOIN invoice inv ON inv.invoice_id = inr.invoice_id WHERE inv.record_id LIKE '20130823.110842.mi003.in\_ zzy0001b6394d3d80b' ESCAPE '\' INTO :_lx_atExe1
 - original query: SELECT inr.invoice_id, inr.row_number, inr.product_id, pr.transfer_id, inr.explanation, inr.delivered_quantity, inr.price__unit, inr.price_total, inr.vat_price, inr.record_id FROM invoice_row inr  LEFT OUTER JOIN product pr ON pr.product_id = inr.product_id  LEFT OUTER JOIN invoice inv ON inv.invoice_id = inr.invoice_id  WHERE inv.record_id LIKE '20130823.110842.mi003.in\_  zzy0001b6394d3d80b' ESCAPE '\'  ORDER BY inr.row_number  INTO :_lx_atExe1,:_lx_alExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_arExe3,:_lx_arExe4,:_lx_atExe5
 - result _lx_atExe1 size: 0
 - query name: new:form/nc/erp-sync/moloni/query-local/order_row-invoice.json. 	23.1.2022 	16:23:45 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT inr.record_id FROM invoice_row inr LEFT OUTER JOIN invoice inv ON inv.invoice_id = inr.invoice_id WHERE inv.record_id LIKE '20130924.103632.is001.in\_ zzy0001b6394d3d809' ESCAPE '\' INTO :_lx_atExe1
 - original query: SELECT inr.invoice_id, inr.row_number, inr.product_id, pr.transfer_id, inr.explanation, inr.delivered_quantity, inr.price__unit, inr.price_total, inr.vat_price, inr.record_id FROM invoice_row inr  LEFT OUTER JOIN product pr ON pr.product_id = inr.product_id  LEFT OUTER JOIN invoice inv ON inv.invoice_id = inr.invoice_id  WHERE inv.record_id LIKE '20130924.103632.is001.in\_  zzy0001b6394d3d809' ESCAPE '\'  ORDER BY inr.row_number  INTO :_lx_atExe1,:_lx_alExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_arExe3,:_lx_arExe4,:_lx_atExe5
 - result _lx_atExe1 size: 0
 - query name: new:form/nc/erp-sync/moloni/query-local/order_row-invoice.json. 	23.1.2022 	16:23:48 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT inr.record_id FROM invoice_row inr LEFT OUTER JOIN invoice inv ON inv.invoice_id = inr.invoice_id WHERE inv.record_id LIKE '20130823.110842.mi003.in\_ zzy0001b6394d3d80b' ESCAPE '\' INTO :_lx_atExe1
 - original query: SELECT inr.invoice_id, inr.row_number, inr.product_id, pr.transfer_id, inr.explanation, inr.delivered_quantity, inr.price__unit, inr.price_total, inr.vat_price, inr.record_id FROM invoice_row inr  LEFT OUTER JOIN product pr ON pr.product_id = inr.product_id  LEFT OUTER JOIN invoice inv ON inv.invoice_id = inr.invoice_id  WHERE inv.record_id LIKE '20130823.110842.mi003.in\_  zzy0001b6394d3d80b' ESCAPE '\'  ORDER BY inr.row_number  INTO :_lx_atExe1,:_lx_alExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_arExe3,:_lx_arExe4,:_lx_atExe5
 - result _lx_atExe1 size: 0
 - query name: new:form/nc/erp-sync/moloni/query-local/order_row-invoice.json. 	23.1.2022 	16:23:48 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT inv.record_id FROM invoice inv WHERE inv.company_id IN ('1057') INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv  WHERE inv.company_id IN ('1057')  ORDER BY inv.invoice_id  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
 - result _lx_atExe1 size: 127, first value: '1300969'
 - query name: new:form/nc/erp-sync/query/order-invoice.json. 	23.1.2022 	16:24:07 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT inr.record_id FROM invoice_row inr LEFT OUTER JOIN invoice inv ON inv.invoice_id = inr.invoice_id WHERE inv.record_id LIKE '20130531.143421.0f00o.in\_ zzy0001b6394d3d809' ESCAPE '\' INTO :_lx_atExe1
 - original query: SELECT inr.invoice_id, inr.row_number, inr.product_id, pr.transfer_id, inr.explanation, inr.delivered_quantity, inr.price__unit, inr.price_total, inr.vat_price, inr.record_id FROM invoice_row inr  LEFT OUTER JOIN product pr ON pr.product_id = inr.product_id  LEFT OUTER JOIN invoice inv ON inv.invoice_id = inr.invoice_id  WHERE inv.record_id LIKE '20130531.143421.0f00o.in\_  zzy0001b6394d3d809' ESCAPE '\'  ORDER BY inr.row_number  INTO :_lx_atExe1,:_lx_alExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_arExe3,:_lx_arExe4,:_lx_atExe5
 - result _lx_atExe1 size: 0
 - query name: new:form/nc/erp-sync/moloni/query-local/order_row-invoice.json. 	23.1.2022 	16:24:13 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT inr.record_id FROM invoice_row inr LEFT OUTER JOIN invoice inv ON inv.invoice_id = inr.invoice_id WHERE inv.record_id LIKE '20130823.110842.mi003.in\_ zzy0001b6394d3d80b' ESCAPE '\' INTO :_lx_atExe1
 - original query: SELECT inr.invoice_id, inr.row_number, inr.product_id, pr.transfer_id, inr.explanation, inr.delivered_quantity, inr.price__unit, inr.price_total, inr.vat_price, inr.record_id FROM invoice_row inr  LEFT OUTER JOIN product pr ON pr.product_id = inr.product_id  LEFT OUTER JOIN invoice inv ON inv.invoice_id = inr.invoice_id  WHERE inv.record_id LIKE '20130823.110842.mi003.in\_  zzy0001b6394d3d80b' ESCAPE '\'  ORDER BY inr.row_number  INTO :_lx_atExe1,:_lx_alExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_arExe3,:_lx_arExe4,:_lx_atExe5
 - result _lx_atExe1 size: 0
 - query name: new:form/nc/erp-sync/moloni/query-local/order_row-invoice.json. 	23.1.2022 	16:24:21 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT inv.record_id FROM invoice inv WHERE inv.company_id IN ('1057') INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv  WHERE inv.company_id IN ('1057')  ORDER BY inv.invoice_id  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
 - result _lx_atExe1 size: 127, first value: '1300969'
 - query name: new:form/nc/erp-sync/query/order-invoice.json. 	23.1.2022 	16:24:50 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT inv.record_id FROM invoice inv WHERE inv.company_id IN ('1057') INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv  WHERE inv.company_id IN ('1057')  ORDER BY inv.invoice_id  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
 - result _lx_atExe1 size: 127, first value: '1300969'
 - query name: new:form/nc/erp-sync/query/order-invoice.json. 	23.1.2022 	16:25:16 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT inv.record_id FROM invoice inv WHERE inv.company_id IN ('1057') INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv  WHERE inv.company_id IN ('1057')  ORDER BY inv.invoice_id  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
 - result _lx_atExe1 size: 127, first value: '1300969'
 - query name: new:form/nc/erp-sync/query/order-invoice.json. 	23.1.2022 	16:25:16 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT inr.record_id FROM invoice_row inr LEFT OUTER JOIN invoice inv ON inv.invoice_id = inr.invoice_id WHERE inv.record_id LIKE '20130924.103632.is001.in\_ zzy0001b6394d3d809' ESCAPE '\' INTO :_lx_atExe1
 - original query: SELECT inr.invoice_id, inr.row_number, inr.product_id, pr.transfer_id, inr.explanation, inr.delivered_quantity, inr.price__unit, inr.price_total, inr.vat_price, inr.record_id FROM invoice_row inr  LEFT OUTER JOIN product pr ON pr.product_id = inr.product_id  LEFT OUTER JOIN invoice inv ON inv.invoice_id = inr.invoice_id  WHERE inv.record_id LIKE '20130924.103632.is001.in\_  zzy0001b6394d3d809' ESCAPE '\'  ORDER BY inr.row_number  INTO :_lx_atExe1,:_lx_alExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_arExe3,:_lx_arExe4,:_lx_atExe5
 - result _lx_atExe1 size: 0
 - query name: new:form/nc/erp-sync/moloni/query-local/order_row-invoice.json. 	23.1.2022 	16:25:23 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT inr.record_id FROM invoice_row inr LEFT OUTER JOIN invoice inv ON inv.invoice_id = inr.invoice_id WHERE inv.record_id LIKE '20130823.110842.mi003.in\_ zzy0001b6394d3d80b' ESCAPE '\' INTO :_lx_atExe1
 - original query: SELECT inr.invoice_id, inr.row_number, inr.product_id, pr.transfer_id, inr.explanation, inr.delivered_quantity, inr.price__unit, inr.price_total, inr.vat_price, inr.record_id FROM invoice_row inr  LEFT OUTER JOIN product pr ON pr.product_id = inr.product_id  LEFT OUTER JOIN invoice inv ON inv.invoice_id = inr.invoice_id  WHERE inv.record_id LIKE '20130823.110842.mi003.in\_  zzy0001b6394d3d80b' ESCAPE '\'  ORDER BY inr.row_number  INTO :_lx_atExe1,:_lx_alExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_arExe3,:_lx_arExe4,:_lx_atExe5
 - result _lx_atExe1 size: 0
 - query name: new:form/nc/erp-sync/moloni/query-local/order_row-invoice.json. 	23.1.2022 	16:25:24 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT inr.record_id FROM invoice_row inr LEFT OUTER JOIN invoice inv ON inv.invoice_id = inr.invoice_id WHERE inv.record_id LIKE '20130531.143421.0f00o.in\_ zzy0001b6394d3d809' ESCAPE '\' INTO :_lx_atExe1
 - original query: SELECT inr.invoice_id, inr.row_number, inr.product_id, pr.transfer_id, inr.explanation, inr.delivered_quantity, inr.price__unit, inr.price_total, inr.vat_price, inr.record_id FROM invoice_row inr  LEFT OUTER JOIN product pr ON pr.product_id = inr.product_id  LEFT OUTER JOIN invoice inv ON inv.invoice_id = inr.invoice_id  WHERE inv.record_id LIKE '20130531.143421.0f00o.in\_  zzy0001b6394d3d809' ESCAPE '\'  ORDER BY inr.row_number  INTO :_lx_atExe1,:_lx_alExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_arExe3,:_lx_arExe4,:_lx_atExe5
 - result _lx_atExe1 size: 0
 - query name: new:form/nc/erp-sync/moloni/query-local/order_row-invoice.json. 	23.1.2022 	16:25:24 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT so.record_id FROM sales_order so WHERE so.project_id <> '' LIMIT 500 INTO :_lx_atExe1
 - original query: SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id FROM sales_order so  WHERE so.project_id <> ''  ORDER BY so.sales_order_id DESC  LIMIT 500  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8
 - result _lx_atExe1 size: 500, first value: '2001066'
 - query name: new:form/nc/erp-sync/woocommerce/query-local/order-sales.json. 	23.1.2022 	16:25:28 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 21, send count: 5, loop count: 4, bytes sent 341124 / 341124, 0 remaining, total send time 53 µs. 	23.1.2022 	16:25:30 	lx 	(5. palvelin)

4D: SELECT so.record_id FROM sales_order so WHERE so.project_id <> '' LIMIT 500 INTO :_lx_atExe1
 - original query: SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id FROM sales_order so  WHERE so.project_id <> ''  ORDER BY so.sales_order_id DESC  LIMIT 500  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8
 - result _lx_atExe1 size: 500, first value: '2001066'
 - query name: new:form/nc/erp-sync/woocommerce/query-local/order-sales.json. 	23.1.2022 	16:25:31 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 22, send result: -1, send count: 1, loop count: 1, bytes sent 81660 / 341127, 259467 remaining, total send time 44 µs. 	23.1.2022 	16:25:32 	lx 	(5. palvelin)

 -- tcp answer 22, send result: -1, send count: 4, loop count: 5, bytes sent 310308 / 341127, 30819 remaining, total send time 1310 µs. 	23.1.2022 	16:25:32 	lx 	(5. palvelin)

 -- tcp answer 22, send count: 5, loop count: 6, bytes sent 341127 / 341127, 0 remaining, total send time 2607 µs. 	23.1.2022 	16:25:32 	lx 	(5. palvelin)

4D: SELECT _prf.record_id FROM _preference _prf WHERE name_id = '_code_SiteCode' INTO :_lx_atExe1
 - original query: SELECT text_value FROM _preference WHERE name_id = '_code_SiteCode'  INTO :_lx_atExe1
 - result _lx_atExe1 size: 1, first value: 'ZZY0'
 - query name: new:dsql.sqlExecuteUnsafe. 	23.1.2022 	16:26:18 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT _prf.record_id FROM _preference _prf WHERE name_id = 'code_default.json' INTO :_lx_atExe1
 - original query: SELECT text_value FROM _preference WHERE name_id = 'code_default.json'  INTO :_lx_atExe1
 - result _lx_atExe1 size: 1, first value: '{
  "code": {
    "_CODE_ALFLD": [4002, 4002, 4002, 4013, 4013, 4013, 8011, 8011, 10004, 11005, 17004, 17004, 17004, 17004, 17004, 17004, 21001, 21001, 21001, 21001, 21001, 21001, 26002, 27001, 28008, 28008, 29001, 29001, 31001, 31001, 31011, 32002, 32002, 33001, 37001, 37001, 42001, 43002, 44012, 44031, 44031, 44032, 48036, 50001, 54001],
    "_CODE_ASFLDNAME": ["[Tosite]TUNNUS", "[Tosite]Tosite ID", "[Tosite]TUNNUS", "[Tosite]Tositenumero", "[Tosite]Tositenumero", "[Tosite]Tositenumero", "[Var'
 - query name: new:dsql.sqlExecuteUnsafe. 	23.1.2022 	16:26:19 	_lx_ExecuteSqlNew 	(5. palvelin)

warning: 
*** sql error:  
INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "date_completed_gmt": "2021-10-08T04:01:57",
  "customer_id": 0,
  "transaction_id": "b9b5739bc0",
  "meta_data": [
    {
      "key": "is_vat_exempt",
      "id": 241915,
      "value": "no"
    },
    {
      "key": "_woo_carrier_agent_id",
      "id": 242117,
      "value": "6277"
    },
    {
      "key": "_woo_carrier_agent_meta",
      "id": 242119,
      "value": {
        "postcode": "03100",
        "street_address": "Tuusankaari 1",
        "id": "6277",
        "city": "Nummela",
        "title": "Automaatti K-Citymarket Nummela",
        "street_address2": "",
        "country": "FI",
        "distance": "0.1",
        "logo_url": "",
        "carrier": "matkahuolto"
      }
    },
    {
      "key": "_wc_matkahuolto",
      "id": 242120,
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}"
    }
  ],
  "order_key": "wc_order_5u5kiQdAERF01",
  "created_via": "checkout",
  "status": "completed",
  "id": 5911,
  "billing": {
    "postcode": "04109",
    "state": "",
    "city": "Nummela",
    "phone": "0407460885",
    "last_name": "Rautiainen",
    "address_2": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "email": "orau@windowslive.com",
    "first_name": "Olli",
    "company": "",
    "country": "FI"
  },
  "date_modified_gmt": "2021-10-08T04:01:57",
  "parent_id": 0,
  "shipping_total": "6.05",
  "shipping_tax": "1.45",
  "number": "5911",
  "currency": "EUR",
  "discount_total": "0.00",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "tax_lines": [
    {
      "rate_id": 1,
      "label": "alv.",
      "compound": false,
      "tax_total": "2.52",
      "shipping_tax_total": "1.45",
      "id": 7282,
      "meta_data": [],
      "rate_code": "FI-ALV.-1"
    }
  ],
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "version": "3.6.2",
  "date_modified": "2021-10-08T07:01:57",
  "date_created": "2021-10-04T16:08:10",
  "date_completed": "2021-10-08T07:01:57",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "date_paid_gmt": "2021-10-04T13:09:38",
  "date_created_gmt": "2021-10-04T13:08:10",
  "total": "20.50",
  "cart_tax": "2.52",
  "discount_tax": "0.00",
  "fee_lines": [],
  "shipping": {
    "postcode": "04109",
    "state": "",
    "city": "Nummela",
    "first_name": "Olli",
    "address_1": "Hopeasepäntie 9 as 3",
    "company": "",
    "address_2": "",
    "last_name": "Rautiainen",
    "country": "FI"
  },
  "refunds": [],
  "_links": {
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ],
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ]
  },
  "payment_method_title": "Paytrail",
  "payment_method": "paytrail",
  "coupon_lines": [],
  "date_paid": "2021-10-04T16:09:38",
  "customer_note": "",
  "line_items": [
    {
      "subtotal": "10.48",
      "meta_data": [],
      "price": 10.48,
      "quantity": 1,
      "product_id": 2149,
      "tax_class": "",
      "taxes": [
        {
          "subtotal": "2.5152",
          "total": "2.5152",
          "id": 1
        }
      ],
      "subtotal_tax": "2.52",
      "sku": "RE_LASERA20B0267",
      "id": 7280,
      "name": "Serafil 20 Beige 0267 WR",
      "total": "10.48",
      "total_tax": "2.52",
      "variation_id": 0
    }
  ],
  "total_tax": "3.97",
  "shipping_lines": [
    {
      "instance_id": "5",
      "taxes": [
        {
          "subtotal": "",
          "total": "1.452",
          "id": 1
        }
      ],
      "total": "6.05",
      "meta_data": [
        {
          "key": "Tuotteet",
          "id": 53885,
          "value": "Serafil 20 Beige 0267 WR &times; 1"
        }
      ],
      "method_title": "Matkahuolto Lähellä-paketti",
      "id": 7281,
      "total_tax": "1.45",
      "method_id": "matkahuolto"
    }
  ]
}', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.162618.r8001.so_  zzy9f84d896921dcrr', 'K', 3.97)


. 	23.1.2022 	16:26:19 	lx 	(5. palvelin)

4D: SELECT so.record_id FROM sales_order so WHERE so.project_id <> '' LIMIT 500 INTO :_lx_atExe1
 - original query: SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id FROM sales_order so  WHERE so.project_id <> ''  ORDER BY so.sales_order_id DESC  LIMIT 500  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8
 - result _lx_atExe1 size: 500, first value: '2001066'
 - query name: new:form/nc/erp-sync/woocommerce/query-local/order-sales.json. 	23.1.2022 	16:28:16 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 26, send count: 5, loop count: 4, bytes sent 341126 / 341126, 0 remaining, total send time 6 µs. 	23.1.2022 	16:28:16 	lx 	(5. palvelin)

*** tcp close for sock 77, type 'nil', protocol 'HTTP', reason: 'POLLHUP', request length: 1 078 bytes ***. 	23.1.2022 	16:28:17 	lx 	(5. palvelin)

closing socket '77'. 	23.1.2022 	16:28:17 	lx 	(5. palvelin)

4D: SELECT _prf.record_id FROM _preference _prf WHERE name_id = '_code_SiteCode' INTO :_lx_atExe1
 - original query: SELECT text_value FROM _preference WHERE name_id = '_code_SiteCode'  INTO :_lx_atExe1
 - result _lx_atExe1 size: 1, first value: 'ZZY0'
 - query name: new:dsql.sqlExecuteUnsafe. 	23.1.2022 	16:30:03 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT _prf.record_id FROM _preference _prf WHERE name_id = 'code_default.json' INTO :_lx_atExe1
 - original query: SELECT text_value FROM _preference WHERE name_id = 'code_default.json'  INTO :_lx_atExe1
 - result _lx_atExe1 size: 1, first value: '{
  "code": {
    "_CODE_ALFLD": [4002, 4002, 4002, 4013, 4013, 4013, 8011, 8011, 10004, 11005, 17004, 17004, 17004, 17004, 17004, 17004, 21001, 21001, 21001, 21001, 21001, 21001, 26002, 27001, 28008, 28008, 29001, 29001, 31001, 31001, 31011, 32002, 32002, 33001, 37001, 37001, 42001, 43002, 44012, 44031, 44031, 44032, 48036, 50001, 54001],
    "_CODE_ASFLDNAME": ["[Tosite]TUNNUS", "[Tosite]Tosite ID", "[Tosite]TUNNUS", "[Tosite]Tositenumero", "[Tosite]Tositenumero", "[Tosite]Tositenumero", "[Var'
 - query name: new:dsql.sqlExecuteUnsafe. 	23.1.2022 	16:30:07 	_lx_ExecuteSqlNew 	(5. palvelin)

sql: Error -1, Duplicated key: 5911 on field Sales_Order_ID of table Sales_Order (dbmg 1115)
Cannot update new record in table Sales_Order of database Manageri_v19 (dbmg 1247)
Cannot save new record in table Sales_Order of database Manageri_v19 (dbmg 1248)
Failed to execute INSERT command. (SQLS 1802)
Failed to execute INSERT command. (dbmg 1248)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "shipping_tax": "1.45",
  "discount_total": "0.00",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "discount_tax": "0.00",
  "tax_lines": [
    {
      "label": "alv.",
      "id": 7282,
      "compound": false,
      "tax_total": "2.52",
      "meta_data": [],
      "rate_code": "FI-ALV.-1",
      "rate_id": 1,
      "shipping_tax_total": "1.45"
    }
  ],
  "version": "3.6.2",
  "date_created_gmt": "2021-10-04T13:08:10",
  "date_paid_gmt": "2021-10-04T13:09:38",
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "date_modified": "2021-10-08T07:01:57",
  "date_created": "2021-10-04T16:08:10",
  "total": "20.50",
  "refunds": [],
  "coupon_lines": [],
  "customer_note": "",
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "id": 7281,
      "method_title": "Matkahuolto Lähellä-paketti",
      "total_tax": "1.45",
      "instance_id": "5",
      "taxes": [
        {
          "id": 1,
          "subtotal": "",
          "total": "1.452"
        }
      ],
      "total": "6.05",
      "meta_data": [
        {
          "id": 53885,
          "key": "Tuotteet",
          "value": "Serafil 20 Beige 0267 WR &times; 1"
        }
      ]
    }
  ],
  "meta_data": [
    {
      "id": 241915,
      "key": "is_vat_exempt",
      "value": "no"
    },
    {
      "id": 242117,
      "key": "_woo_carrier_agent_id",
      "value": "6277"
    },
    {
      "id": 242119,
      "key": "_woo_carrier_agent_meta",
      "value": {
        "postcode": "03100",
        "street_address": "Tuusankaari 1",
        "city": "Nummela",
        "id": "6277",
        "logo_url": "",
        "distance": "0.1",
        "title": "Automaatti K-Citymarket Nummela",
        "street_address2": "",
        "carrier": "matkahuolto",
        "country": "FI"
      }
    },
    {
      "id": 242120,
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}"
    }
  ],
  "total_tax": "3.97",
  "currency": "EUR",
  "parent_id": 0,
  "date_completed": "2021-10-08T07:01:57",
  "date_paid": "2021-10-04T16:09:38",
  "cart_tax": "2.52",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "payment_method_title": "Paytrail",
  "fee_lines": [],
  "shipping": {
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "company": "",
    "city": "Nummela",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "postcode": "04109",
    "state": "",
    "country": "FI"
  },
  "created_via": "checkout",
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ]
  },
  "status": "completed",
  "billing": {
    "state": "",
    "postcode": "04109",
    "company": "",
    "phone": "0407460885",
    "city": "Nummela",
    "email": "orau@windowslive.com",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "country": "FI"
  },
  "payment_method": "paytrail",
  "line_items": [
    {
      "price": 10.48,
      "variation_id": 0,
      "total_tax": "2.52",
      "name": "Serafil 20 Beige 0267 WR",
      "total": "10.48",
      "quantity": 1,
      "product_id": 2149,
      "tax_class": "",
      "subtotal_tax": "2.52",
      "sku": "RE_LASERA20B0267",
      "meta_data": [],
      "taxes": [
        {
          "id": 1,
          "subtotal": "2.5152",
          "total": "2.5152"
        }
      ],
      "subtotal": "10.48",
      "id": 7280
    }
  ],
  "transaction_id": "b9b5739bc0",
  "id": 5911,
  "customer_id": 0,
  "date_completed_gmt": "2021-10-08T04:01:57",
  "number": "5911",
  "order_key": "wc_order_5u5kiQdAERF01",
  "date_modified_gmt": "2021-10-08T04:01:57",
  "shipping_total": "6.05"
}', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.163003.mc001.so_  zzy9f84d896921dcrr', 'K', 3.97)
'
INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "shipping_tax": "1.45",
  "discount_total": "0.00",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "discount_tax": "0.00",
  "tax_lines": [
    {
      "label": "alv.",
      "id": 7282,
      "compound": false,
      "tax_total": "2.52",
      "meta_data": [],
      "rate_code": "FI-ALV.-1",
      "rate_id": 1,
      "shipping_tax_total": "1.45"
    }
  ],
  "version": "3.6.2",
  "date_created_gmt": "2021-10-04T13:08:10",
  "date_paid_gmt": "2021-10-04T13:09:38",
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "date_modified": "2021-10-08T07:01:57",
  "date_created": "2021-10-04T16:08:10",
  "total": "20.50",
  "refunds": [],
  "coupon_lines": [],
  "customer_note": "",
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "id": 7281,
      "method_title": "Matkahuolto Lähellä-paketti",
      "total_tax": "1.45",
      "instance_id": "5",
      "taxes": [
        {
          "id": 1,
          "subtotal": "",
          "total": "1.452"
        }
      ],
      "total": "6.05",
      "meta_data": [
        {
          "id": 53885,
          "key": "Tuotteet",
          "value": "Serafil 20 Beige 0267 WR &times; 1"
        }
      ]
    }
  ],
  "meta_data": [
    {
      "id": 241915,
      "key": "is_vat_exempt",
      "value": "no"
    },
    {
      "id": 242117,
      "key": "_woo_carrier_agent_id",
      "value": "6277"
    },
    {
      "id": 242119,
      "key": "_woo_carrier_agent_meta",
      "value": {
        "postcode": "03100",
        "street_address": "Tuusankaari 1",
        "city": "Nummela",
        "id": "6277",
        "logo_url": "",
        "distance": "0.1",
        "title": "Automaatti K-Citymarket Nummela",
        "street_address2": "",
        "carrier": "matkahuolto",
        "country": "FI"
      }
    },
    {
      "id": 242120,
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}"
    }
  ],
  "total_tax": "3.97",
  "currency": "EUR",
  "parent_id": 0,
  "date_completed": "2021-10-08T07:01:57",
  "date_paid": "2021-10-04T16:09:38",
  "cart_tax": "2.52",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "payment_method_title": "Paytrail",
  "fee_lines": [],
  "shipping": {
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "company": "",
    "city": "Nummela",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "postcode": "04109",
    "state": "",
    "country": "FI"
  },
  "created_via": "checkout",
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ]
  },
  "status": "completed",
  "billing": {
    "state": "",
    "postcode": "04109",
    "company": "",
    "phone": "0407460885",
    "city": "Nummela",
    "email": "orau@windowslive.com",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "country": "FI"
  },
  "payment_method": "paytrail",
  "line_items": [
    {
      "price": 10.48,
      "variation_id": 0,
      "total_tax": "2.52",
      "name": "Serafil 20 Beige 0267 WR",
      "total": "10.48",
      "quantity": 1,
      "product_id": 2149,
      "tax_class": "",
      "subtotal_tax": "2.52",
      "sku": "RE_LASERA20B0267",
      "meta_data": [],
      "taxes": [
        {
          "id": 1,
          "subtotal": "2.5152",
          "total": "2.5152"
        }
      ],
      "subtotal": "10.48",
      "id": 7280
    }
  ],
  "transaction_id": "b9b5739bc0",
  "id": 5911,
  "customer_id": 0,
  "date_completed_gmt": "2021-10-08T04:01:57",
  "number": "5911",
  "order_key": "wc_order_5u5kiQdAERF01",
  "date_modified_gmt": "2021-10-08T04:01:57",
  "shipping_total": "6.05"
}', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.163003.mc001.so_  zzy9f84d896921dcrr', 'K', 3.97)
'
 	23.1.2022 	16:30:17 	_lx_ExecuteSqlNew 	(5. palvelin)

warning: 
*** sql error: 4d execute sql error -1: Error -1, Duplicated key: 5911 on field Sales_Order_ID of table Sales_Order (dbmg 1115)
Cannot update new record in table Sales_Order of database Manageri_v19 (dbmg 1247)
Cannot save new record in table Sales_Order of database Manageri_v19 (dbmg 1248)
Failed to execute INSERT command. (SQLS 1802)
Failed to execute INSERT command. (dbmg 1248)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "shipping_tax": "1.45",
  "discount_total": "0.00",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "discount_tax": "0.00",
  "tax_lines": [
    {
      "label": "alv.",
      "id": 7282,
      "compound": false,
      "tax_total": "2.52",
      "meta_data": [],
      "rate_code": "FI-ALV.-1",
      "rate_id": 1,
      "shipping_tax_total": "1.45"
    }
  ],
  "version": "3.6.2",
  "date_created_gmt": "2021-10-04T13:08:10",
  "date_paid_gmt": "2021-10-04T13:09:38",
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "date_modified": "2021-10-08T07:01:57",
  "date_created": "2021-10-04T16:08:10",
  "total": "20.50",
  "refunds": [],
  "coupon_lines": [],
  "customer_note": "",
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "id": 7281,
      "method_title": "Matkahuolto Lähellä-paketti",
      "total_tax": "1.45",
      "instance_id": "5",
      "taxes": [
        {
          "id": 1,
          "subtotal": "",
          "total": "1.452"
        }
      ],
      "total": "6.05",
      "meta_data": [
        {
          "id": 53885,
          "key": "Tuotteet",
          "value": "Serafil 20 Beige 0267 WR &times; 1"
        }
      ]
    }
  ],
  "meta_data": [
    {
      "id": 241915,
      "key": "is_vat_exempt",
      "value": "no"
    },
    {
      "id": 242117,
      "key": "_woo_carrier_agent_id",
      "value": "6277"
    },
    {
      "id": 242119,
      "key": "_woo_carrier_agent_meta",
      "value": {
        "postcode": "03100",
        "street_address": "Tuusankaari 1",
        "city": "Nummela",
        "id": "6277",
        "logo_url": "",
        "distance": "0.1",
        "title": "Automaatti K-Citymarket Nummela",
        "street_address2": "",
        "carrier": "matkahuolto",
        "country": "FI"
      }
    },
    {
      "id": 242120,
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}"
    }
  ],
  "total_tax": "3.97",
  "currency": "EUR",
  "parent_id": 0,
  "date_completed": "2021-10-08T07:01:57",
  "date_paid": "2021-10-04T16:09:38",
  "cart_tax": "2.52",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "payment_method_title": "Paytrail",
  "fee_lines": [],
  "shipping": {
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "company": "",
    "city": "Nummela",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "postcode": "04109",
    "state": "",
    "country": "FI"
  },
  "created_via": "checkout",
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ]
  },
  "status": "completed",
  "billing": {
    "state": "",
    "postcode": "04109",
    "company": "",
    "phone": "0407460885",
    "city": "Nummela",
    "email": "orau@windowslive.com",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "country": "FI"
  },
  "payment_method": "paytrail",
  "line_items": [
    {
      "price": 10.48,
      "variation_id": 0,
      "total_tax": "2.52",
      "name": "Serafil 20 Beige 0267 WR",
      "total": "10.48",
      "quantity": 1,
      "product_id": 2149,
      "tax_class": "",
      "subtotal_tax": "2.52",
      "sku": "RE_LASERA20B0267",
      "meta_data": [],
      "taxes": [
        {
          "id": 1,
          "subtotal": "2.5152",
          "total": "2.5152"
        }
      ],
      "subtotal": "10.48",
      "id": 7280
    }
  ],
  "transaction_id": "b9b5739bc0",
  "id": 5911,
  "customer_id": 0,
  "date_completed_gmt": "2021-10-08T04:01:57",
  "number": "5911",
  "order_key": "wc_order_5u5kiQdAERF01",
  "date_modified_gmt": "2021-10-08T04:01:57",
  "shipping_total": "6.05"
}', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.163003.mc001.so_  zzy9f84d896921dcrr', 'K', 3.97) 
INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "shipping_tax": "1.45",
  "discount_total": "0.00",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "discount_tax": "0.00",
  "tax_lines": [
    {
      "label": "alv.",
      "id": 7282,
      "compound": false,
      "tax_total": "2.52",
      "meta_data": [],
      "rate_code": "FI-ALV.-1",
      "rate_id": 1,
      "shipping_tax_total": "1.45"
    }
  ],
  "version": "3.6.2",
  "date_created_gmt": "2021-10-04T13:08:10",
  "date_paid_gmt": "2021-10-04T13:09:38",
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "date_modified": "2021-10-08T07:01:57",
  "date_created": "2021-10-04T16:08:10",
  "total": "20.50",
  "refunds": [],
  "coupon_lines": [],
  "customer_note": "",
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "id": 7281,
      "method_title": "Matkahuolto Lähellä-paketti",
      "total_tax": "1.45",
      "instance_id": "5",
      "taxes": [
        {
          "id": 1,
          "subtotal": "",
          "total": "1.452"
        }
      ],
      "total": "6.05",
      "meta_data": [
        {
          "id": 53885,
          "key": "Tuotteet",
          "value": "Serafil 20 Beige 0267 WR &times; 1"
        }
      ]
    }
  ],
  "meta_data": [
    {
      "id": 241915,
      "key": "is_vat_exempt",
      "value": "no"
    },
    {
      "id": 242117,
      "key": "_woo_carrier_agent_id",
      "value": "6277"
    },
    {
      "id": 242119,
      "key": "_woo_carrier_agent_meta",
      "value": {
        "postcode": "03100",
        "street_address": "Tuusankaari 1",
        "city": "Nummela",
        "id": "6277",
        "logo_url": "",
        "distance": "0.1",
        "title": "Automaatti K-Citymarket Nummela",
        "street_address2": "",
        "carrier": "matkahuolto",
        "country": "FI"
      }
    },
    {
      "id": 242120,
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}"
    }
  ],
  "total_tax": "3.97",
  "currency": "EUR",
  "parent_id": 0,
  "date_completed": "2021-10-08T07:01:57",
  "date_paid": "2021-10-04T16:09:38",
  "cart_tax": "2.52",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "payment_method_title": "Paytrail",
  "fee_lines": [],
  "shipping": {
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "company": "",
    "city": "Nummela",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "postcode": "04109",
    "state": "",
    "country": "FI"
  },
  "created_via": "checkout",
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ]
  },
  "status": "completed",
  "billing": {
    "state": "",
    "postcode": "04109",
    "company": "",
    "phone": "0407460885",
    "city": "Nummela",
    "email": "orau@windowslive.com",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "country": "FI"
  },
  "payment_method": "paytrail",
  "line_items": [
    {
      "price": 10.48,
      "variation_id": 0,
      "total_tax": "2.52",
      "name": "Serafil 20 Beige 0267 WR",
      "total": "10.48",
      "quantity": 1,
      "product_id": 2149,
      "tax_class": "",
      "subtotal_tax": "2.52",
      "sku": "RE_LASERA20B0267",
      "meta_data": [],
      "taxes": [
        {
          "id": 1,
          "subtotal": "2.5152",
          "total": "2.5152"
        }
      ],
      "subtotal": "10.48",
      "id": 7280
    }
  ],
  "transaction_id": "b9b5739bc0",
  "id": 5911,
  "customer_id": 0,
  "date_completed_gmt": "2021-10-08T04:01:57",
  "number": "5911",
  "order_key": "wc_order_5u5kiQdAERF01",
  "date_modified_gmt": "2021-10-08T04:01:57",
  "shipping_total": "6.05"
}', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.163003.mc001.so_  zzy9f84d896921dcrr', 'K', 3.97)


. 	23.1.2022 	16:30:17 	lx 	(5. palvelin)

4d execute sql error -1: Error -1, Duplicated key: 5911 on field Sales_Order_ID of table Sales_Order (dbmg 1115)
Cannot update new record in table Sales_Order of database Manageri_v19 (dbmg 1247)
Cannot save new record in table Sales_Order of database Manageri_v19 (dbmg 1248)
Failed to execute INSERT command. (SQLS 1802)
Failed to execute INSERT command. (dbmg 1248)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "shipping_tax": "1.45",
  "discount_total": "0.00",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "discount_tax": "0.00",
  "tax_lines": [
    {
      "label": "alv.",
      "id": 7282,
      "compound": false,
      "tax_total": "2.52",
      "meta_data": [],
      "rate_code": "FI-ALV.-1",
      "rate_id": 1,
      "shipping_tax_total": "1.45"
    }
  ],
  "version": "3.6.2",
  "date_created_gmt": "2021-10-04T13:08:10",
  "date_paid_gmt": "2021-10-04T13:09:38",
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "date_modified": "2021-10-08T07:01:57",
  "date_created": "2021-10-04T16:08:10",
  "total": "20.50",
  "refunds": [],
  "coupon_lines": [],
  "customer_note": "",
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "id": 7281,
      "method_title": "Matkahuolto Lähellä-paketti",
      "total_tax": "1.45",
      "instance_id": "5",
      "taxes": [
        {
          "id": 1,
          "subtotal": "",
          "total": "1.452"
        }
      ],
      "total": "6.05",
      "meta_data": [
        {
          "id": 53885,
          "key": "Tuotteet",
          "value": "Serafil 20 Beige 0267 WR &times; 1"
        }
      ]
    }
  ],
  "meta_data": [
    {
      "id": 241915,
      "key": "is_vat_exempt",
      "value": "no"
    },
    {
      "id": 242117,
      "key": "_woo_carrier_agent_id",
      "value": "6277"
    },
    {
      "id": 242119,
      "key": "_woo_carrier_agent_meta",
      "value": {
        "postcode": "03100",
        "street_address": "Tuusankaari 1",
        "city": "Nummela",
        "id": "6277",
        "logo_url": "",
        "distance": "0.1",
        "title": "Automaatti K-Citymarket Nummela",
        "street_address2": "",
        "carrier": "matkahuolto",
        "country": "FI"
      }
    },
    {
      "id": 242120,
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}"
    }
  ],
  "total_tax": "3.97",
  "currency": "EUR",
  "parent_id": 0,
  "date_completed": "2021-10-08T07:01:57",
  "date_paid": "2021-10-04T16:09:38",
  "cart_tax": "2.52",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "payment_method_title": "Paytrail",
  "fee_lines": [],
  "shipping": {
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "company": "",
    "city": "Nummela",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "postcode": "04109",
    "state": "",
    "country": "FI"
  },
  "created_via": "checkout",
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ]
  },
  "status": "completed",
  "billing": {
    "state": "",
    "postcode": "04109",
    "company": "",
    "phone": "0407460885",
    "city": "Nummela",
    "email": "orau@windowslive.com",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "country": "FI"
  },
  "payment_method": "paytrail",
  "line_items": [
    {
      "price": 10.48,
      "variation_id": 0,
      "total_tax": "2.52",
      "name": "Serafil 20 Beige 0267 WR",
      "total": "10.48",
      "quantity": 1,
      "product_id": 2149,
      "tax_class": "",
      "subtotal_tax": "2.52",
      "sku": "RE_LASERA20B0267",
      "meta_data": [],
      "taxes": [
        {
          "id": 1,
          "subtotal": "2.5152",
          "total": "2.5152"
        }
      ],
      "subtotal": "10.48",
      "id": 7280
    }
  ],
  "transaction_id": "b9b5739bc0",
  "id": 5911,
  "customer_id": 0,
  "date_completed_gmt": "2021-10-08T04:01:57",
  "number": "5911",
  "order_key": "wc_order_5u5kiQdAERF01",
  "date_modified_gmt": "2021-10-08T04:01:57",
  "shipping_total": "6.05"
}', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.163003.mc001.so_  zzy9f84d896921dcrr', 'K', 3.97). 	23.1.2022 	16:30:17 	_lx_SERVER 	(5. palvelin)

4D: SELECT so.record_id FROM sales_order so WHERE so.project_id <> '' LIMIT 500 INTO :_lx_atExe1
 - original query: SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id FROM sales_order so  WHERE so.project_id <> ''  ORDER BY so.sales_order_id DESC  LIMIT 500  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8
 - result _lx_atExe1 size: 500, first value: '2001066'
 - query name: new:form/nc/erp-sync/woocommerce/query-local/order-sales.json. 	23.1.2022 	16:31:54 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 30, send result: -1, send count: 4, loop count: 4, bytes sent 326640 / 341127, 14487 remaining, total send time 24 µs. 	23.1.2022 	16:31:54 	lx 	(5. palvelin)

 -- tcp answer 30, send count: 5, loop count: 5, bytes sent 341127 / 341127, 0 remaining, total send time 1267 µs. 	23.1.2022 	16:31:54 	lx 	(5. palvelin)

sql: Error -1, Duplicated key: 5911 on field Sales_Order_ID of table Sales_Order (dbmg 1115)
Cannot update new record in table Sales_Order of database Manageri_v19 (dbmg 1247)
Cannot save new record in table Sales_Order of database Manageri_v19 (dbmg 1248)
Failed to execute INSERT command. (SQLS 1802)
Failed to execute INSERT command. (dbmg 1248)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "date_paid_gmt": "2021-10-04T13:09:38",
  "tax_lines": [
    {
      "rate_id": 1,
      "meta_data": [],
      "label": "alv.",
      "id": 7282,
      "compound": false,
      "tax_total": "2.52",
      "shipping_tax_total": "1.45",
      "rate_code": "FI-ALV.-1"
    }
  ],
  "discount_total": "0.00",
  "date_completed": "2021-10-08T07:01:57",
  "version": "3.6.2",
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "date_modified": "2021-10-08T07:01:57",
  "date_created": "2021-10-04T16:08:10",
  "transaction_id": "b9b5739bc0",
  "total": "20.50",
  "refunds": [],
  "coupon_lines": [],
  "customer_note": "",
  "shipping_lines": [
    {
      "total": "6.05",
      "meta_data": [
        {
          "id": 53885,
          "key": "Tuotteet",
          "value": "Serafil 20 Beige 0267 WR &times; 1"
        }
      ],
      "method_id": "matkahuolto",
      "total_tax": "1.45",
      "method_title": "Matkahuolto Lähellä-paketti",
      "id": 7281,
      "instance_id": "5",
      "taxes": [
        {
          "subtotal": "",
          "id": 1,
          "total": "1.452"
        }
      ]
    }
  ],
  "number": "5911",
  "meta_data": [
    {
      "id": 241915,
      "key": "is_vat_exempt",
      "value": "no"
    },
    {
      "id": 242117,
      "key": "_woo_carrier_agent_id",
      "value": "6277"
    },
    {
      "id": 242119,
      "key": "_woo_carrier_agent_meta",
      "value": {
        "city": "Nummela",
        "street_address": "Tuusankaari 1",
        "street_address2": "",
        "logo_url": "",
        "distance": "0.1",
        "carrier": "matkahuolto",
        "id": "6277",
        "title": "Automaatti K-Citymarket Nummela",
        "country": "FI",
        "postcode": "03100"
      }
    },
    {
      "id": 242120,
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}"
    }
  ],
  "customer_id": 0,
  "total_tax": "3.97",
  "line_items": [
    {
      "total": "10.48",
      "quantity": 1,
      "price": 10.48,
      "id": 7280,
      "total_tax": "2.52",
      "tax_class": "",
      "product_id": 2149,
      "meta_data": [],
      "subtotal": "10.48",
      "variation_id": 0,
      "sku": "RE_LASERA20B0267",
      "taxes": [
        {
          "subtotal": "2.5152",
          "id": 1,
          "total": "2.5152"
        }
      ],
      "name": "Serafil 20 Beige 0267 WR",
      "subtotal_tax": "2.52"
    }
  ],
  "currency": "EUR",
  "parent_id": 0,
  "date_created_gmt": "2021-10-04T13:08:10",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "date_paid": "2021-10-04T16:09:38",
  "fee_lines": [],
  "shipping": {
    "first_name": "Olli",
    "city": "Nummela",
    "company": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "country": "FI",
    "last_name": "Rautiainen",
    "state": "",
    "postcode": "04109"
  },
  "payment_method": "paytrail",
  "billing": {
    "state": "",
    "city": "Nummela",
    "company": "",
    "phone": "0407460885",
    "address_1": "Hopeasepäntie 9 as 3",
    "email": "orau@windowslive.com",
    "address_2": "",
    "country": "FI",
    "last_name": "Rautiainen",
    "first_name": "Olli",
    "postcode": "04109"
  },
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ]
  },
  "cart_tax": "2.52",
  "status": "completed",
  "discount_tax": "0.00",
  "created_via": "checkout",
  "order_key": "wc_order_5u5kiQdAERF01",
  "payment_method_title": "Paytrail",
  "id": 5911,
  "date_modified_gmt": "2021-10-08T04:01:57",
  "shipping_total": "6.05",
  "shipping_tax": "1.45",
  "date_completed_gmt": "2021-10-08T04:01:57",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117"
}', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.163215.f7002.so_  zzy9f84d896921dcrr', 'K', 3.97)
'
INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "date_paid_gmt": "2021-10-04T13:09:38",
  "tax_lines": [
    {
      "rate_id": 1,
      "meta_data": [],
      "label": "alv.",
      "id": 7282,
      "compound": false,
      "tax_total": "2.52",
      "shipping_tax_total": "1.45",
      "rate_code": "FI-ALV.-1"
    }
  ],
  "discount_total": "0.00",
  "date_completed": "2021-10-08T07:01:57",
  "version": "3.6.2",
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "date_modified": "2021-10-08T07:01:57",
  "date_created": "2021-10-04T16:08:10",
  "transaction_id": "b9b5739bc0",
  "total": "20.50",
  "refunds": [],
  "coupon_lines": [],
  "customer_note": "",
  "shipping_lines": [
    {
      "total": "6.05",
      "meta_data": [
        {
          "id": 53885,
          "key": "Tuotteet",
          "value": "Serafil 20 Beige 0267 WR &times; 1"
        }
      ],
      "method_id": "matkahuolto",
      "total_tax": "1.45",
      "method_title": "Matkahuolto Lähellä-paketti",
      "id": 7281,
      "instance_id": "5",
      "taxes": [
        {
          "subtotal": "",
          "id": 1,
          "total": "1.452"
        }
      ]
    }
  ],
  "number": "5911",
  "meta_data": [
    {
      "id": 241915,
      "key": "is_vat_exempt",
      "value": "no"
    },
    {
      "id": 242117,
      "key": "_woo_carrier_agent_id",
      "value": "6277"
    },
    {
      "id": 242119,
      "key": "_woo_carrier_agent_meta",
      "value": {
        "city": "Nummela",
        "street_address": "Tuusankaari 1",
        "street_address2": "",
        "logo_url": "",
        "distance": "0.1",
        "carrier": "matkahuolto",
        "id": "6277",
        "title": "Automaatti K-Citymarket Nummela",
        "country": "FI",
        "postcode": "03100"
      }
    },
    {
      "id": 242120,
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}"
    }
  ],
  "customer_id": 0,
  "total_tax": "3.97",
  "line_items": [
    {
      "total": "10.48",
      "quantity": 1,
      "price": 10.48,
      "id": 7280,
      "total_tax": "2.52",
      "tax_class": "",
      "product_id": 2149,
      "meta_data": [],
      "subtotal": "10.48",
      "variation_id": 0,
      "sku": "RE_LASERA20B0267",
      "taxes": [
        {
          "subtotal": "2.5152",
          "id": 1,
          "total": "2.5152"
        }
      ],
      "name": "Serafil 20 Beige 0267 WR",
      "subtotal_tax": "2.52"
    }
  ],
  "currency": "EUR",
  "parent_id": 0,
  "date_created_gmt": "2021-10-04T13:08:10",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "date_paid": "2021-10-04T16:09:38",
  "fee_lines": [],
  "shipping": {
    "first_name": "Olli",
    "city": "Nummela",
    "company": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "country": "FI",
    "last_name": "Rautiainen",
    "state": "",
    "postcode": "04109"
  },
  "payment_method": "paytrail",
  "billing": {
    "state": "",
    "city": "Nummela",
    "company": "",
    "phone": "0407460885",
    "address_1": "Hopeasepäntie 9 as 3",
    "email": "orau@windowslive.com",
    "address_2": "",
    "country": "FI",
    "last_name": "Rautiainen",
    "first_name": "Olli",
    "postcode": "04109"
  },
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ]
  },
  "cart_tax": "2.52",
  "status": "completed",
  "discount_tax": "0.00",
  "created_via": "checkout",
  "order_key": "wc_order_5u5kiQdAERF01",
  "payment_method_title": "Paytrail",
  "id": 5911,
  "date_modified_gmt": "2021-10-08T04:01:57",
  "shipping_total": "6.05",
  "shipping_tax": "1.45",
  "date_completed_gmt": "2021-10-08T04:01:57",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117"
}', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.163215.f7002.so_  zzy9f84d896921dcrr', 'K', 3.97)
'
 	23.1.2022 	16:32:16 	_lx_ExecuteSqlNew 	(5. palvelin)

warning: 
*** sql error: 4d execute sql error -1: Error -1, Duplicated key: 5911 on field Sales_Order_ID of table Sales_Order (dbmg 1115)
Cannot update new record in table Sales_Order of database Manageri_v19 (dbmg 1247)
Cannot save new record in table Sales_Order of database Manageri_v19 (dbmg 1248)
Failed to execute INSERT command. (SQLS 1802)
Failed to execute INSERT command. (dbmg 1248)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "date_paid_gmt": "2021-10-04T13:09:38",
  "tax_lines": [
    {
      "rate_id": 1,
      "meta_data": [],
      "label": "alv.",
      "id": 7282,
      "compound": false,
      "tax_total": "2.52",
      "shipping_tax_total": "1.45",
      "rate_code": "FI-ALV.-1"
    }
  ],
  "discount_total": "0.00",
  "date_completed": "2021-10-08T07:01:57",
  "version": "3.6.2",
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "date_modified": "2021-10-08T07:01:57",
  "date_created": "2021-10-04T16:08:10",
  "transaction_id": "b9b5739bc0",
  "total": "20.50",
  "refunds": [],
  "coupon_lines": [],
  "customer_note": "",
  "shipping_lines": [
    {
      "total": "6.05",
      "meta_data": [
        {
          "id": 53885,
          "key": "Tuotteet",
          "value": "Serafil 20 Beige 0267 WR &times; 1"
        }
      ],
      "method_id": "matkahuolto",
      "total_tax": "1.45",
      "method_title": "Matkahuolto Lähellä-paketti",
      "id": 7281,
      "instance_id": "5",
      "taxes": [
        {
          "subtotal": "",
          "id": 1,
          "total": "1.452"
        }
      ]
    }
  ],
  "number": "5911",
  "meta_data": [
    {
      "id": 241915,
      "key": "is_vat_exempt",
      "value": "no"
    },
    {
      "id": 242117,
      "key": "_woo_carrier_agent_id",
      "value": "6277"
    },
    {
      "id": 242119,
      "key": "_woo_carrier_agent_meta",
      "value": {
        "city": "Nummela",
        "street_address": "Tuusankaari 1",
        "street_address2": "",
        "logo_url": "",
        "distance": "0.1",
        "carrier": "matkahuolto",
        "id": "6277",
        "title": "Automaatti K-Citymarket Nummela",
        "country": "FI",
        "postcode": "03100"
      }
    },
    {
      "id": 242120,
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}"
    }
  ],
  "customer_id": 0,
  "total_tax": "3.97",
  "line_items": [
    {
      "total": "10.48",
      "quantity": 1,
      "price": 10.48,
      "id": 7280,
      "total_tax": "2.52",
      "tax_class": "",
      "product_id": 2149,
      "meta_data": [],
      "subtotal": "10.48",
      "variation_id": 0,
      "sku": "RE_LASERA20B0267",
      "taxes": [
        {
          "subtotal": "2.5152",
          "id": 1,
          "total": "2.5152"
        }
      ],
      "name": "Serafil 20 Beige 0267 WR",
      "subtotal_tax": "2.52"
    }
  ],
  "currency": "EUR",
  "parent_id": 0,
  "date_created_gmt": "2021-10-04T13:08:10",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "date_paid": "2021-10-04T16:09:38",
  "fee_lines": [],
  "shipping": {
    "first_name": "Olli",
    "city": "Nummela",
    "company": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "country": "FI",
    "last_name": "Rautiainen",
    "state": "",
    "postcode": "04109"
  },
  "payment_method": "paytrail",
  "billing": {
    "state": "",
    "city": "Nummela",
    "company": "",
    "phone": "0407460885",
    "address_1": "Hopeasepäntie 9 as 3",
    "email": "orau@windowslive.com",
    "address_2": "",
    "country": "FI",
    "last_name": "Rautiainen",
    "first_name": "Olli",
    "postcode": "04109"
  },
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ]
  },
  "cart_tax": "2.52",
  "status": "completed",
  "discount_tax": "0.00",
  "created_via": "checkout",
  "order_key": "wc_order_5u5kiQdAERF01",
  "payment_method_title": "Paytrail",
  "id": 5911,
  "date_modified_gmt": "2021-10-08T04:01:57",
  "shipping_total": "6.05",
  "shipping_tax": "1.45",
  "date_completed_gmt": "2021-10-08T04:01:57",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117"
}', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.163215.f7002.so_  zzy9f84d896921dcrr', 'K', 3.97) 
INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "date_paid_gmt": "2021-10-04T13:09:38",
  "tax_lines": [
    {
      "rate_id": 1,
      "meta_data": [],
      "label": "alv.",
      "id": 7282,
      "compound": false,
      "tax_total": "2.52",
      "shipping_tax_total": "1.45",
      "rate_code": "FI-ALV.-1"
    }
  ],
  "discount_total": "0.00",
  "date_completed": "2021-10-08T07:01:57",
  "version": "3.6.2",
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "date_modified": "2021-10-08T07:01:57",
  "date_created": "2021-10-04T16:08:10",
  "transaction_id": "b9b5739bc0",
  "total": "20.50",
  "refunds": [],
  "coupon_lines": [],
  "customer_note": "",
  "shipping_lines": [
    {
      "total": "6.05",
      "meta_data": [
        {
          "id": 53885,
          "key": "Tuotteet",
          "value": "Serafil 20 Beige 0267 WR &times; 1"
        }
      ],
      "method_id": "matkahuolto",
      "total_tax": "1.45",
      "method_title": "Matkahuolto Lähellä-paketti",
      "id": 7281,
      "instance_id": "5",
      "taxes": [
        {
          "subtotal": "",
          "id": 1,
          "total": "1.452"
        }
      ]
    }
  ],
  "number": "5911",
  "meta_data": [
    {
      "id": 241915,
      "key": "is_vat_exempt",
      "value": "no"
    },
    {
      "id": 242117,
      "key": "_woo_carrier_agent_id",
      "value": "6277"
    },
    {
      "id": 242119,
      "key": "_woo_carrier_agent_meta",
      "value": {
        "city": "Nummela",
        "street_address": "Tuusankaari 1",
        "street_address2": "",
        "logo_url": "",
        "distance": "0.1",
        "carrier": "matkahuolto",
        "id": "6277",
        "title": "Automaatti K-Citymarket Nummela",
        "country": "FI",
        "postcode": "03100"
      }
    },
    {
      "id": 242120,
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}"
    }
  ],
  "customer_id": 0,
  "total_tax": "3.97",
  "line_items": [
    {
      "total": "10.48",
      "quantity": 1,
      "price": 10.48,
      "id": 7280,
      "total_tax": "2.52",
      "tax_class": "",
      "product_id": 2149,
      "meta_data": [],
      "subtotal": "10.48",
      "variation_id": 0,
      "sku": "RE_LASERA20B0267",
      "taxes": [
        {
          "subtotal": "2.5152",
          "id": 1,
          "total": "2.5152"
        }
      ],
      "name": "Serafil 20 Beige 0267 WR",
      "subtotal_tax": "2.52"
    }
  ],
  "currency": "EUR",
  "parent_id": 0,
  "date_created_gmt": "2021-10-04T13:08:10",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "date_paid": "2021-10-04T16:09:38",
  "fee_lines": [],
  "shipping": {
    "first_name": "Olli",
    "city": "Nummela",
    "company": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "country": "FI",
    "last_name": "Rautiainen",
    "state": "",
    "postcode": "04109"
  },
  "payment_method": "paytrail",
  "billing": {
    "state": "",
    "city": "Nummela",
    "company": "",
    "phone": "0407460885",
    "address_1": "Hopeasepäntie 9 as 3",
    "email": "orau@windowslive.com",
    "address_2": "",
    "country": "FI",
    "last_name": "Rautiainen",
    "first_name": "Olli",
    "postcode": "04109"
  },
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ]
  },
  "cart_tax": "2.52",
  "status": "completed",
  "discount_tax": "0.00",
  "created_via": "checkout",
  "order_key": "wc_order_5u5kiQdAERF01",
  "payment_method_title": "Paytrail",
  "id": 5911,
  "date_modified_gmt": "2021-10-08T04:01:57",
  "shipping_total": "6.05",
  "shipping_tax": "1.45",
  "date_completed_gmt": "2021-10-08T04:01:57",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117"
}', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.163215.f7002.so_  zzy9f84d896921dcrr', 'K', 3.97)


. 	23.1.2022 	16:32:16 	lx 	(5. palvelin)

4d execute sql error -1: Error -1, Duplicated key: 5911 on field Sales_Order_ID of table Sales_Order (dbmg 1115)
Cannot update new record in table Sales_Order of database Manageri_v19 (dbmg 1247)
Cannot save new record in table Sales_Order of database Manageri_v19 (dbmg 1248)
Failed to execute INSERT command. (SQLS 1802)
Failed to execute INSERT command. (dbmg 1248)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "date_paid_gmt": "2021-10-04T13:09:38",
  "tax_lines": [
    {
      "rate_id": 1,
      "meta_data": [],
      "label": "alv.",
      "id": 7282,
      "compound": false,
      "tax_total": "2.52",
      "shipping_tax_total": "1.45",
      "rate_code": "FI-ALV.-1"
    }
  ],
  "discount_total": "0.00",
  "date_completed": "2021-10-08T07:01:57",
  "version": "3.6.2",
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "date_modified": "2021-10-08T07:01:57",
  "date_created": "2021-10-04T16:08:10",
  "transaction_id": "b9b5739bc0",
  "total": "20.50",
  "refunds": [],
  "coupon_lines": [],
  "customer_note": "",
  "shipping_lines": [
    {
      "total": "6.05",
      "meta_data": [
        {
          "id": 53885,
          "key": "Tuotteet",
          "value": "Serafil 20 Beige 0267 WR &times; 1"
        }
      ],
      "method_id": "matkahuolto",
      "total_tax": "1.45",
      "method_title": "Matkahuolto Lähellä-paketti",
      "id": 7281,
      "instance_id": "5",
      "taxes": [
        {
          "subtotal": "",
          "id": 1,
          "total": "1.452"
        }
      ]
    }
  ],
  "number": "5911",
  "meta_data": [
    {
      "id": 241915,
      "key": "is_vat_exempt",
      "value": "no"
    },
    {
      "id": 242117,
      "key": "_woo_carrier_agent_id",
      "value": "6277"
    },
    {
      "id": 242119,
      "key": "_woo_carrier_agent_meta",
      "value": {
        "city": "Nummela",
        "street_address": "Tuusankaari 1",
        "street_address2": "",
        "logo_url": "",
        "distance": "0.1",
        "carrier": "matkahuolto",
        "id": "6277",
        "title": "Automaatti K-Citymarket Nummela",
        "country": "FI",
        "postcode": "03100"
      }
    },
    {
      "id": 242120,
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}"
    }
  ],
  "customer_id": 0,
  "total_tax": "3.97",
  "line_items": [
    {
      "total": "10.48",
      "quantity": 1,
      "price": 10.48,
      "id": 7280,
      "total_tax": "2.52",
      "tax_class": "",
      "product_id": 2149,
      "meta_data": [],
      "subtotal": "10.48",
      "variation_id": 0,
      "sku": "RE_LASERA20B0267",
      "taxes": [
        {
          "subtotal": "2.5152",
          "id": 1,
          "total": "2.5152"
        }
      ],
      "name": "Serafil 20 Beige 0267 WR",
      "subtotal_tax": "2.52"
    }
  ],
  "currency": "EUR",
  "parent_id": 0,
  "date_created_gmt": "2021-10-04T13:08:10",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "date_paid": "2021-10-04T16:09:38",
  "fee_lines": [],
  "shipping": {
    "first_name": "Olli",
    "city": "Nummela",
    "company": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "country": "FI",
    "last_name": "Rautiainen",
    "state": "",
    "postcode": "04109"
  },
  "payment_method": "paytrail",
  "billing": {
    "state": "",
    "city": "Nummela",
    "company": "",
    "phone": "0407460885",
    "address_1": "Hopeasepäntie 9 as 3",
    "email": "orau@windowslive.com",
    "address_2": "",
    "country": "FI",
    "last_name": "Rautiainen",
    "first_name": "Olli",
    "postcode": "04109"
  },
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ]
  },
  "cart_tax": "2.52",
  "status": "completed",
  "discount_tax": "0.00",
  "created_via": "checkout",
  "order_key": "wc_order_5u5kiQdAERF01",
  "payment_method_title": "Paytrail",
  "id": 5911,
  "date_modified_gmt": "2021-10-08T04:01:57",
  "shipping_total": "6.05",
  "shipping_tax": "1.45",
  "date_completed_gmt": "2021-10-08T04:01:57",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117"
}', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.163215.f7002.so_  zzy9f84d896921dcrr', 'K', 3.97). 	23.1.2022 	16:32:16 	_lx_SERVER 	(5. palvelin)

4D: SELECT so.record_id FROM sales_order so WHERE so.project_id <> '' LIMIT 500 INTO :_lx_atExe1
 - original query: SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id FROM sales_order so  WHERE so.project_id <> ''  ORDER BY so.sales_order_id DESC  LIMIT 500  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8
 - result _lx_atExe1 size: 500, first value: '2001066'
 - query name: new:form/nc/erp-sync/woocommerce/query-local/order-sales.json. 	23.1.2022 	16:33:02 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 32, send count: 5, loop count: 4, bytes sent 341126 / 341126, 0 remaining, total send time 570 µs. 	23.1.2022 	16:33:02 	lx 	(5. palvelin)

*** tcp close for sock 77, type 'nil', protocol 'HTTP', reason: 'POLLHUP', request length: 1 085 bytes ***. 	23.1.2022 	16:36:06 	lx 	(5. palvelin)

closing socket '77'. 	23.1.2022 	16:36:06 	lx 	(5. palvelin)

4D: SELECT so.record_id FROM sales_order so WHERE so.project_id <> '' LIMIT 500 INTO :_lx_atExe1
 - original query: SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id FROM sales_order so  WHERE so.project_id <> ''  ORDER BY so.sales_order_id DESC  LIMIT 500  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8
 - result _lx_atExe1 size: 500, first value: '2001066'
 - query name: new:form/nc/erp-sync/woocommerce/query-local/order-sales.json. 	23.1.2022 	16:36:14 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 33, send count: 5, loop count: 4, bytes sent 341127 / 341127, 0 remaining, total send time 6 µs. 	23.1.2022 	16:36:14 	lx 	(5. palvelin)

4D: SELECT _prf.record_id FROM _preference _prf WHERE name_id = '_code_SiteCode' INTO :_lx_atExe1
 - original query: SELECT text_value FROM _preference WHERE name_id = '_code_SiteCode'  INTO :_lx_atExe1
 - result _lx_atExe1 size: 1, first value: 'ZZY0'
 - query name: new:dsql.sqlExecuteUnsafe. 	23.1.2022 	16:36:24 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT _prf.record_id FROM _preference _prf WHERE name_id = 'code_default.json' INTO :_lx_atExe1
 - original query: SELECT text_value FROM _preference WHERE name_id = 'code_default.json'  INTO :_lx_atExe1
 - result _lx_atExe1 size: 1, first value: '{
  "code": {
    "_CODE_ALFLD": [4002, 4002, 4002, 4013, 4013, 4013, 8011, 8011, 10004, 11005, 17004, 17004, 17004, 17004, 17004, 17004, 21001, 21001, 21001, 21001, 21001, 21001, 26002, 27001, 28008, 28008, 29001, 29001, 31001, 31001, 31011, 32002, 32002, 33001, 37001, 37001, 42001, 43002, 44012, 44031, 44031, 44032, 48036, 50001, 54001],
    "_CODE_ASFLDNAME": ["[Tosite]TUNNUS", "[Tosite]Tosite ID", "[Tosite]TUNNUS", "[Tosite]Tositenumero", "[Tosite]Tositenumero", "[Tosite]Tositenumero", "[Var'
 - query name: new:dsql.sqlExecuteUnsafe. 	23.1.2022 	16:36:24 	_lx_ExecuteSqlNew 	(5. palvelin)

sql: Error -1, Duplicated key: 5911 on field Sales_Order_ID of table Sales_Order (dbmg 1115)
Cannot update new record in table Sales_Order of database Manageri_v19 (dbmg 1247)
Cannot save new record in table Sales_Order of database Manageri_v19 (dbmg 1248)
Failed to execute INSERT command. (SQLS 1802)
Failed to execute INSERT command. (dbmg 1248)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "discount_total": "0.00",
  "transaction_id": "b9b5739bc0",
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "customer_id": 0,
  "date_modified": "2021-10-08T07:01:57",
  "date_created": "2021-10-04T16:08:10",
  "total": "20.50",
  "refunds": [],
  "coupon_lines": [],
  "customer_note": "",
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "method_title": "Matkahuolto Lähellä-paketti",
      "total_tax": "1.45",
      "instance_id": "5",
      "taxes": [
        {
          "total": "1.452",
          "id": 1,
          "subtotal": ""
        }
      ],
      "id": 7281,
      "total": "6.05",
      "meta_data": [
        {
          "id": 53885,
          "key": "Tuotteet",
          "value": "Serafil 20 Beige 0267 WR &times; 1"
        }
      ]
    }
  ],
  "meta_data": [
    {
      "id": 241915,
      "key": "is_vat_exempt",
      "value": "no"
    },
    {
      "id": 242117,
      "key": "_woo_carrier_agent_id",
      "value": "6277"
    },
    {
      "id": 242119,
      "key": "_woo_carrier_agent_meta",
      "value": {
        "street_address2": "",
        "logo_url": "",
        "distance": "0.1",
        "carrier": "matkahuolto",
        "street_address": "Tuusankaari 1",
        "title": "Automaatti K-Citymarket Nummela",
        "postcode": "03100",
        "id": "6277",
        "city": "Nummela",
        "country": "FI"
      }
    },
    {
      "id": 242120,
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}"
    }
  ],
  "total_tax": "3.97",
  "line_items": [
    {
      "tax_class": "",
      "subtotal_tax": "2.52",
      "sku": "RE_LASERA20B0267",
      "taxes": [
        {
          "total": "2.5152",
          "id": 1,
          "subtotal": "2.5152"
        }
      ],
      "subtotal": "10.48",
      "price": 10.48,
      "variation_id": 0,
      "meta_data": [],
      "total": "10.48",
      "total_tax": "2.52",
      "id": 7280,
      "product_id": 2149,
      "quantity": 1,
      "name": "Serafil 20 Beige 0267 WR"
    }
  ],
  "date_completed": "2021-10-08T07:01:57",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "date_paid_gmt": "2021-10-04T13:09:38",
  "fee_lines": [],
  "shipping": {
    "company": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "country": "FI",
    "postcode": "04109",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "city": "Nummela",
    "state": ""
  },
  "order_key": "wc_order_5u5kiQdAERF01",
  "date_created_gmt": "2021-10-04T13:08:10",
  "created_via": "checkout",
  "date_modified_gmt": "2021-10-08T04:01:57",
  "id": 5911,
  "billing": {
    "company": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "country": "FI",
    "city": "Nummela",
    "email": "orau@windowslive.com",
    "postcode": "04109",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "state": "",
    "phone": "0407460885"
  },
  "payment_method": "paytrail",
  "_links": {
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ],
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ]
  },
  "status": "completed",
  "payment_method_title": "Paytrail",
  "discount_tax": "0.00",
  "cart_tax": "2.52",
  "date_paid": "2021-10-04T16:09:38",
  "date_completed_gmt": "2021-10-08T04:01:57",
  "number": "5911",
  "shipping_total": "6.05",
  "version": "3.6.2",
  "parent_id": 0,
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "shipping_tax": "1.45",
  "tax_lines": [
    {
      "rate_id": 1,
      "compound": false,
      "tax_total": "2.52",
      "shipping_tax_total": "1.45",
      "rate_code": "FI-ALV.-1",
      "meta_data": [],
      "id": 7282,
      "label": "alv."
    }
  ],
  "currency": "EUR"
}', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.163624.du001.so_  zzy9f84d896921dcrr', 'K', 3.97)
'
INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "discount_total": "0.00",
  "transaction_id": "b9b5739bc0",
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "customer_id": 0,
  "date_modified": "2021-10-08T07:01:57",
  "date_created": "2021-10-04T16:08:10",
  "total": "20.50",
  "refunds": [],
  "coupon_lines": [],
  "customer_note": "",
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "method_title": "Matkahuolto Lähellä-paketti",
      "total_tax": "1.45",
      "instance_id": "5",
      "taxes": [
        {
          "total": "1.452",
          "id": 1,
          "subtotal": ""
        }
      ],
      "id": 7281,
      "total": "6.05",
      "meta_data": [
        {
          "id": 53885,
          "key": "Tuotteet",
          "value": "Serafil 20 Beige 0267 WR &times; 1"
        }
      ]
    }
  ],
  "meta_data": [
    {
      "id": 241915,
      "key": "is_vat_exempt",
      "value": "no"
    },
    {
      "id": 242117,
      "key": "_woo_carrier_agent_id",
      "value": "6277"
    },
    {
      "id": 242119,
      "key": "_woo_carrier_agent_meta",
      "value": {
        "street_address2": "",
        "logo_url": "",
        "distance": "0.1",
        "carrier": "matkahuolto",
        "street_address": "Tuusankaari 1",
        "title": "Automaatti K-Citymarket Nummela",
        "postcode": "03100",
        "id": "6277",
        "city": "Nummela",
        "country": "FI"
      }
    },
    {
      "id": 242120,
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}"
    }
  ],
  "total_tax": "3.97",
  "line_items": [
    {
      "tax_class": "",
      "subtotal_tax": "2.52",
      "sku": "RE_LASERA20B0267",
      "taxes": [
        {
          "total": "2.5152",
          "id": 1,
          "subtotal": "2.5152"
        }
      ],
      "subtotal": "10.48",
      "price": 10.48,
      "variation_id": 0,
      "meta_data": [],
      "total": "10.48",
      "total_tax": "2.52",
      "id": 7280,
      "product_id": 2149,
      "quantity": 1,
      "name": "Serafil 20 Beige 0267 WR"
    }
  ],
  "date_completed": "2021-10-08T07:01:57",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "date_paid_gmt": "2021-10-04T13:09:38",
  "fee_lines": [],
  "shipping": {
    "company": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "country": "FI",
    "postcode": "04109",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "city": "Nummela",
    "state": ""
  },
  "order_key": "wc_order_5u5kiQdAERF01",
  "date_created_gmt": "2021-10-04T13:08:10",
  "created_via": "checkout",
  "date_modified_gmt": "2021-10-08T04:01:57",
  "id": 5911,
  "billing": {
    "company": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "country": "FI",
    "city": "Nummela",
    "email": "orau@windowslive.com",
    "postcode": "04109",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "state": "",
    "phone": "0407460885"
  },
  "payment_method": "paytrail",
  "_links": {
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ],
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ]
  },
  "status": "completed",
  "payment_method_title": "Paytrail",
  "discount_tax": "0.00",
  "cart_tax": "2.52",
  "date_paid": "2021-10-04T16:09:38",
  "date_completed_gmt": "2021-10-08T04:01:57",
  "number": "5911",
  "shipping_total": "6.05",
  "version": "3.6.2",
  "parent_id": 0,
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "shipping_tax": "1.45",
  "tax_lines": [
    {
      "rate_id": 1,
      "compound": false,
      "tax_total": "2.52",
      "shipping_tax_total": "1.45",
      "rate_code": "FI-ALV.-1",
      "meta_data": [],
      "id": 7282,
      "label": "alv."
    }
  ],
  "currency": "EUR"
}', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.163624.du001.so_  zzy9f84d896921dcrr', 'K', 3.97)
'
 	23.1.2022 	16:36:24 	_lx_ExecuteSqlNew 	(5. palvelin)

warning: 
*** sql error: 4d execute sql error -1: Error -1, Duplicated key: 5911 on field Sales_Order_ID of table Sales_Order (dbmg 1115)
Cannot update new record in table Sales_Order of database Manageri_v19 (dbmg 1247)
Cannot save new record in table Sales_Order of database Manageri_v19 (dbmg 1248)
Failed to execute INSERT command. (SQLS 1802)
Failed to execute INSERT command. (dbmg 1248)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "discount_total": "0.00",
  "transaction_id": "b9b5739bc0",
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "customer_id": 0,
  "date_modified": "2021-10-08T07:01:57",
  "date_created": "2021-10-04T16:08:10",
  "total": "20.50",
  "refunds": [],
  "coupon_lines": [],
  "customer_note": "",
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "method_title": "Matkahuolto Lähellä-paketti",
      "total_tax": "1.45",
      "instance_id": "5",
      "taxes": [
        {
          "total": "1.452",
          "id": 1,
          "subtotal": ""
        }
      ],
      "id": 7281,
      "total": "6.05",
      "meta_data": [
        {
          "id": 53885,
          "key": "Tuotteet",
          "value": "Serafil 20 Beige 0267 WR &times; 1"
        }
      ]
    }
  ],
  "meta_data": [
    {
      "id": 241915,
      "key": "is_vat_exempt",
      "value": "no"
    },
    {
      "id": 242117,
      "key": "_woo_carrier_agent_id",
      "value": "6277"
    },
    {
      "id": 242119,
      "key": "_woo_carrier_agent_meta",
      "value": {
        "street_address2": "",
        "logo_url": "",
        "distance": "0.1",
        "carrier": "matkahuolto",
        "street_address": "Tuusankaari 1",
        "title": "Automaatti K-Citymarket Nummela",
        "postcode": "03100",
        "id": "6277",
        "city": "Nummela",
        "country": "FI"
      }
    },
    {
      "id": 242120,
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}"
    }
  ],
  "total_tax": "3.97",
  "line_items": [
    {
      "tax_class": "",
      "subtotal_tax": "2.52",
      "sku": "RE_LASERA20B0267",
      "taxes": [
        {
          "total": "2.5152",
          "id": 1,
          "subtotal": "2.5152"
        }
      ],
      "subtotal": "10.48",
      "price": 10.48,
      "variation_id": 0,
      "meta_data": [],
      "total": "10.48",
      "total_tax": "2.52",
      "id": 7280,
      "product_id": 2149,
      "quantity": 1,
      "name": "Serafil 20 Beige 0267 WR"
    }
  ],
  "date_completed": "2021-10-08T07:01:57",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "date_paid_gmt": "2021-10-04T13:09:38",
  "fee_lines": [],
  "shipping": {
    "company": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "country": "FI",
    "postcode": "04109",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "city": "Nummela",
    "state": ""
  },
  "order_key": "wc_order_5u5kiQdAERF01",
  "date_created_gmt": "2021-10-04T13:08:10",
  "created_via": "checkout",
  "date_modified_gmt": "2021-10-08T04:01:57",
  "id": 5911,
  "billing": {
    "company": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "country": "FI",
    "city": "Nummela",
    "email": "orau@windowslive.com",
    "postcode": "04109",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "state": "",
    "phone": "0407460885"
  },
  "payment_method": "paytrail",
  "_links": {
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ],
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ]
  },
  "status": "completed",
  "payment_method_title": "Paytrail",
  "discount_tax": "0.00",
  "cart_tax": "2.52",
  "date_paid": "2021-10-04T16:09:38",
  "date_completed_gmt": "2021-10-08T04:01:57",
  "number": "5911",
  "shipping_total": "6.05",
  "version": "3.6.2",
  "parent_id": 0,
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "shipping_tax": "1.45",
  "tax_lines": [
    {
      "rate_id": 1,
      "compound": false,
      "tax_total": "2.52",
      "shipping_tax_total": "1.45",
      "rate_code": "FI-ALV.-1",
      "meta_data": [],
      "id": 7282,
      "label": "alv."
    }
  ],
  "currency": "EUR"
}', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.163624.du001.so_  zzy9f84d896921dcrr', 'K', 3.97) 
INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "discount_total": "0.00",
  "transaction_id": "b9b5739bc0",
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "customer_id": 0,
  "date_modified": "2021-10-08T07:01:57",
  "date_created": "2021-10-04T16:08:10",
  "total": "20.50",
  "refunds": [],
  "coupon_lines": [],
  "customer_note": "",
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "method_title": "Matkahuolto Lähellä-paketti",
      "total_tax": "1.45",
      "instance_id": "5",
      "taxes": [
        {
          "total": "1.452",
          "id": 1,
          "subtotal": ""
        }
      ],
      "id": 7281,
      "total": "6.05",
      "meta_data": [
        {
          "id": 53885,
          "key": "Tuotteet",
          "value": "Serafil 20 Beige 0267 WR &times; 1"
        }
      ]
    }
  ],
  "meta_data": [
    {
      "id": 241915,
      "key": "is_vat_exempt",
      "value": "no"
    },
    {
      "id": 242117,
      "key": "_woo_carrier_agent_id",
      "value": "6277"
    },
    {
      "id": 242119,
      "key": "_woo_carrier_agent_meta",
      "value": {
        "street_address2": "",
        "logo_url": "",
        "distance": "0.1",
        "carrier": "matkahuolto",
        "street_address": "Tuusankaari 1",
        "title": "Automaatti K-Citymarket Nummela",
        "postcode": "03100",
        "id": "6277",
        "city": "Nummela",
        "country": "FI"
      }
    },
    {
      "id": 242120,
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}"
    }
  ],
  "total_tax": "3.97",
  "line_items": [
    {
      "tax_class": "",
      "subtotal_tax": "2.52",
      "sku": "RE_LASERA20B0267",
      "taxes": [
        {
          "total": "2.5152",
          "id": 1,
          "subtotal": "2.5152"
        }
      ],
      "subtotal": "10.48",
      "price": 10.48,
      "variation_id": 0,
      "meta_data": [],
      "total": "10.48",
      "total_tax": "2.52",
      "id": 7280,
      "product_id": 2149,
      "quantity": 1,
      "name": "Serafil 20 Beige 0267 WR"
    }
  ],
  "date_completed": "2021-10-08T07:01:57",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "date_paid_gmt": "2021-10-04T13:09:38",
  "fee_lines": [],
  "shipping": {
    "company": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "country": "FI",
    "postcode": "04109",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "city": "Nummela",
    "state": ""
  },
  "order_key": "wc_order_5u5kiQdAERF01",
  "date_created_gmt": "2021-10-04T13:08:10",
  "created_via": "checkout",
  "date_modified_gmt": "2021-10-08T04:01:57",
  "id": 5911,
  "billing": {
    "company": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "country": "FI",
    "city": "Nummela",
    "email": "orau@windowslive.com",
    "postcode": "04109",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "state": "",
    "phone": "0407460885"
  },
  "payment_method": "paytrail",
  "_links": {
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ],
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ]
  },
  "status": "completed",
  "payment_method_title": "Paytrail",
  "discount_tax": "0.00",
  "cart_tax": "2.52",
  "date_paid": "2021-10-04T16:09:38",
  "date_completed_gmt": "2021-10-08T04:01:57",
  "number": "5911",
  "shipping_total": "6.05",
  "version": "3.6.2",
  "parent_id": 0,
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "shipping_tax": "1.45",
  "tax_lines": [
    {
      "rate_id": 1,
      "compound": false,
      "tax_total": "2.52",
      "shipping_tax_total": "1.45",
      "rate_code": "FI-ALV.-1",
      "meta_data": [],
      "id": 7282,
      "label": "alv."
    }
  ],
  "currency": "EUR"
}', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.163624.du001.so_  zzy9f84d896921dcrr', 'K', 3.97)


. 	23.1.2022 	16:36:24 	lx 	(5. palvelin)

4d execute sql error -1: Error -1, Duplicated key: 5911 on field Sales_Order_ID of table Sales_Order (dbmg 1115)
Cannot update new record in table Sales_Order of database Manageri_v19 (dbmg 1247)
Cannot save new record in table Sales_Order of database Manageri_v19 (dbmg 1248)
Failed to execute INSERT command. (SQLS 1802)
Failed to execute INSERT command. (dbmg 1248)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "discount_total": "0.00",
  "transaction_id": "b9b5739bc0",
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "customer_id": 0,
  "date_modified": "2021-10-08T07:01:57",
  "date_created": "2021-10-04T16:08:10",
  "total": "20.50",
  "refunds": [],
  "coupon_lines": [],
  "customer_note": "",
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "method_title": "Matkahuolto Lähellä-paketti",
      "total_tax": "1.45",
      "instance_id": "5",
      "taxes": [
        {
          "total": "1.452",
          "id": 1,
          "subtotal": ""
        }
      ],
      "id": 7281,
      "total": "6.05",
      "meta_data": [
        {
          "id": 53885,
          "key": "Tuotteet",
          "value": "Serafil 20 Beige 0267 WR &times; 1"
        }
      ]
    }
  ],
  "meta_data": [
    {
      "id": 241915,
      "key": "is_vat_exempt",
      "value": "no"
    },
    {
      "id": 242117,
      "key": "_woo_carrier_agent_id",
      "value": "6277"
    },
    {
      "id": 242119,
      "key": "_woo_carrier_agent_meta",
      "value": {
        "street_address2": "",
        "logo_url": "",
        "distance": "0.1",
        "carrier": "matkahuolto",
        "street_address": "Tuusankaari 1",
        "title": "Automaatti K-Citymarket Nummela",
        "postcode": "03100",
        "id": "6277",
        "city": "Nummela",
        "country": "FI"
      }
    },
    {
      "id": 242120,
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}"
    }
  ],
  "total_tax": "3.97",
  "line_items": [
    {
      "tax_class": "",
      "subtotal_tax": "2.52",
      "sku": "RE_LASERA20B0267",
      "taxes": [
        {
          "total": "2.5152",
          "id": 1,
          "subtotal": "2.5152"
        }
      ],
      "subtotal": "10.48",
      "price": 10.48,
      "variation_id": 0,
      "meta_data": [],
      "total": "10.48",
      "total_tax": "2.52",
      "id": 7280,
      "product_id": 2149,
      "quantity": 1,
      "name": "Serafil 20 Beige 0267 WR"
    }
  ],
  "date_completed": "2021-10-08T07:01:57",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "date_paid_gmt": "2021-10-04T13:09:38",
  "fee_lines": [],
  "shipping": {
    "company": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "country": "FI",
    "postcode": "04109",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "city": "Nummela",
    "state": ""
  },
  "order_key": "wc_order_5u5kiQdAERF01",
  "date_created_gmt": "2021-10-04T13:08:10",
  "created_via": "checkout",
  "date_modified_gmt": "2021-10-08T04:01:57",
  "id": 5911,
  "billing": {
    "company": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "country": "FI",
    "city": "Nummela",
    "email": "orau@windowslive.com",
    "postcode": "04109",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "state": "",
    "phone": "0407460885"
  },
  "payment_method": "paytrail",
  "_links": {
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ],
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ]
  },
  "status": "completed",
  "payment_method_title": "Paytrail",
  "discount_tax": "0.00",
  "cart_tax": "2.52",
  "date_paid": "2021-10-04T16:09:38",
  "date_completed_gmt": "2021-10-08T04:01:57",
  "number": "5911",
  "shipping_total": "6.05",
  "version": "3.6.2",
  "parent_id": 0,
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "shipping_tax": "1.45",
  "tax_lines": [
    {
      "rate_id": 1,
      "compound": false,
      "tax_total": "2.52",
      "shipping_tax_total": "1.45",
      "rate_code": "FI-ALV.-1",
      "meta_data": [],
      "id": 7282,
      "label": "alv."
    }
  ],
  "currency": "EUR"
}', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.163624.du001.so_  zzy9f84d896921dcrr', 'K', 3.97). 	23.1.2022 	16:36:24 	_lx_SERVER 	(5. palvelin)

4D: SELECT so.record_id FROM sales_order so WHERE so.project_id <> '' LIMIT 500 INTO :_lx_atExe1
 - original query: SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id FROM sales_order so  WHERE so.project_id <> ''  ORDER BY so.sales_order_id DESC  LIMIT 500  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8
 - result _lx_atExe1 size: 500, first value: '2001066'
 - query name: new:form/nc/erp-sync/woocommerce/query-local/order-sales.json. 	23.1.2022 	16:36:31 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 37, send count: 5, loop count: 4, bytes sent 341126 / 341126, 0 remaining, total send time 5 µs. 	23.1.2022 	16:36:31 	lx 	(5. palvelin)

*** tcp close for sock 77, type 'nil', protocol 'HTTP', reason: 'POLLHUP', request length: 1 095 bytes ***. 	23.1.2022 	16:41:15 	lx 	(5. palvelin)

closing socket '77'. 	23.1.2022 	16:41:15 	lx 	(5. palvelin)

4D: SELECT so.record_id FROM sales_order so WHERE so.project_id <> '' LIMIT 500 INTO :_lx_atExe1
 - original query: SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id FROM sales_order so  WHERE so.project_id <> ''  ORDER BY so.sales_order_id DESC  LIMIT 500  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8
 - result _lx_atExe1 size: 500, first value: '2001066'
 - query name: new:form/nc/erp-sync/woocommerce/query-local/order-sales.json. 	23.1.2022 	16:41:24 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 38, send count: 5, loop count: 4, bytes sent 341127 / 341127, 0 remaining, total send time 12 µs. 	23.1.2022 	16:41:24 	lx 	(5. palvelin)

4D: SELECT so.record_id FROM sales_order so WHERE so.project_id <> '' LIMIT 500 INTO :_lx_atExe1
 - original query: SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id FROM sales_order so  WHERE so.project_id <> ''  ORDER BY so.sales_order_id DESC  LIMIT 500  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8
 - result _lx_atExe1 size: 500, first value: '2001066'
 - query name: new:form/nc/erp-sync/woocommerce/query-local/order-sales.json. 	23.1.2022 	16:41:28 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 39, send count: 5, loop count: 4, bytes sent 341132 / 341132, 0 remaining, total send time 5 µs. 	23.1.2022 	16:41:28 	lx 	(5. palvelin)

4D: SELECT _prf.record_id FROM _preference _prf WHERE name_id = '_code_SiteCode' INTO :_lx_atExe1
 - original query: SELECT text_value FROM _preference WHERE name_id = '_code_SiteCode'  INTO :_lx_atExe1
 - result _lx_atExe1 size: 1, first value: 'ZZY0'
 - query name: new:dsql.sqlExecuteUnsafe. 	23.1.2022 	16:41:33 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT _prf.record_id FROM _preference _prf WHERE name_id = 'code_default.json' INTO :_lx_atExe1
 - original query: SELECT text_value FROM _preference WHERE name_id = 'code_default.json'  INTO :_lx_atExe1
 - result _lx_atExe1 size: 1, first value: '{
  "code": {
    "_CODE_ALFLD": [4002, 4002, 4002, 4013, 4013, 4013, 8011, 8011, 10004, 11005, 17004, 17004, 17004, 17004, 17004, 17004, 21001, 21001, 21001, 21001, 21001, 21001, 26002, 27001, 28008, 28008, 29001, 29001, 31001, 31001, 31011, 32002, 32002, 33001, 37001, 37001, 42001, 43002, 44012, 44031, 44031, 44032, 48036, 50001, 54001],
    "_CODE_ASFLDNAME": ["[Tosite]TUNNUS", "[Tosite]Tosite ID", "[Tosite]TUNNUS", "[Tosite]Tositenumero", "[Tosite]Tositenumero", "[Tosite]Tositenumero", "[Var'
 - query name: new:dsql.sqlExecuteUnsafe. 	23.1.2022 	16:41:33 	_lx_ExecuteSqlNew 	(5. palvelin)

sql: Error -1, Duplicated key: 5911 on field Sales_Order_ID of table Sales_Order (dbmg 1115)
Cannot update new record in table Sales_Order of database Manageri_v19 (dbmg 1247)
Cannot save new record in table Sales_Order of database Manageri_v19 (dbmg 1248)
Failed to execute INSERT command. (SQLS 1802)
Failed to execute INSERT command. (dbmg 1248)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "status": "completed",
  "date_modified_gmt": "2021-10-08T04:01:57",
  "shipping_total": "6.05",
  "shipping_tax": "1.45",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "tax_lines": [
    {
      "rate_id": 1,
      "compound": false,
      "tax_total": "2.52",
      "shipping_tax_total": "1.45",
      "rate_code": "FI-ALV.-1",
      "id": 7282,
      "meta_data": [],
      "label": "alv."
    }
  ],
  "version": "3.6.2",
  "parent_id": 0,
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "currency": "EUR",
  "date_modified": "2021-10-08T07:01:57",
  "date_created": "2021-10-04T16:08:10",
  "total": "20.50",
  "refunds": [],
  "coupon_lines": [],
  "customer_note": "",
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "method_title": "Matkahuolto Lähellä-paketti",
      "total_tax": "1.45",
      "instance_id": "5",
      "taxes": [
        {
          "total": "1.452",
          "subtotal": "",
          "id": 1
        }
      ],
      "total": "6.05",
      "meta_data": [
        {
          "key": "Tuotteet",
          "value": "Serafil 20 Beige 0267 WR &times; 1",
          "id": 53885
        }
      ],
      "id": 7281
    }
  ],
  "date_completed_gmt": "2021-10-08T04:01:57",
  "number": "5911",
  "cart_tax": "2.52",
  "meta_data": [
    {
      "key": "is_vat_exempt",
      "value": "no",
      "id": 241915
    },
    {
      "key": "_woo_carrier_agent_id",
      "value": "6277",
      "id": 242117
    },
    {
      "key": "_woo_carrier_agent_meta",
      "value": {
        "street_address2": "",
        "logo_url": "",
        "distance": "0.1",
        "title": "Automaatti K-Citymarket Nummela",
        "street_address": "Tuusankaari 1",
        "country": "FI",
        "postcode": "03100",
        "carrier": "matkahuolto",
        "city": "Nummela",
        "id": "6277"
      },
      "id": 242119
    },
    {
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}",
      "id": 242120
    }
  ],
  "date_created_gmt": "2021-10-04T13:08:10",
  "date_paid_gmt": "2021-10-04T13:09:38",
  "total_tax": "3.97",
  "transaction_id": "b9b5739bc0",
  "line_items": [
    {
      "tax_class": "",
      "subtotal_tax": "2.52",
      "sku": "RE_LASERA20B0267",
      "taxes": [
        {
          "total": "2.5152",
          "subtotal": "2.5152",
          "id": 1
        }
      ],
      "subtotal": "10.48",
      "meta_data": [],
      "variation_id": 0,
      "price": 10.48,
      "product_id": 2149,
      "total_tax": "2.52",
      "name": "Serafil 20 Beige 0267 WR",
      "total": "10.48",
      "quantity": 1,
      "id": 7280
    }
  ],
  "date_completed": "2021-10-08T07:01:57",
  "discount_total": "0.00",
  "date_paid": "2021-10-04T16:09:38",
  "discount_tax": "0.00",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "payment_method_title": "Paytrail",
  "fee_lines": [],
  "shipping": {
    "state": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "company": "",
    "address_2": "",
    "last_name": "Rautiainen",
    "country": "FI",
    "postcode": "04109",
    "first_name": "Olli",
    "city": "Nummela"
  },
  "order_key": "wc_order_5u5kiQdAERF01",
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ]
  },
  "created_via": "checkout",
  "payment_method": "paytrail",
  "customer_id": 0,
  "billing": {
    "state": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "company": "",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "phone": "0407460885",
    "country": "FI",
    "email": "orau@windowslive.com",
    "postcode": "04109",
    "address_2": "",
    "city": "Nummela"
  },
  "id": 5911
}', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.164133.pi001.so_  zzy9f84d896921dcrr', 'K', 3.97)
'
INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "status": "completed",
  "date_modified_gmt": "2021-10-08T04:01:57",
  "shipping_total": "6.05",
  "shipping_tax": "1.45",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "tax_lines": [
    {
      "rate_id": 1,
      "compound": false,
      "tax_total": "2.52",
      "shipping_tax_total": "1.45",
      "rate_code": "FI-ALV.-1",
      "id": 7282,
      "meta_data": [],
      "label": "alv."
    }
  ],
  "version": "3.6.2",
  "parent_id": 0,
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "currency": "EUR",
  "date_modified": "2021-10-08T07:01:57",
  "date_created": "2021-10-04T16:08:10",
  "total": "20.50",
  "refunds": [],
  "coupon_lines": [],
  "customer_note": "",
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "method_title": "Matkahuolto Lähellä-paketti",
      "total_tax": "1.45",
      "instance_id": "5",
      "taxes": [
        {
          "total": "1.452",
          "subtotal": "",
          "id": 1
        }
      ],
      "total": "6.05",
      "meta_data": [
        {
          "key": "Tuotteet",
          "value": "Serafil 20 Beige 0267 WR &times; 1",
          "id": 53885
        }
      ],
      "id": 7281
    }
  ],
  "date_completed_gmt": "2021-10-08T04:01:57",
  "number": "5911",
  "cart_tax": "2.52",
  "meta_data": [
    {
      "key": "is_vat_exempt",
      "value": "no",
      "id": 241915
    },
    {
      "key": "_woo_carrier_agent_id",
      "value": "6277",
      "id": 242117
    },
    {
      "key": "_woo_carrier_agent_meta",
      "value": {
        "street_address2": "",
        "logo_url": "",
        "distance": "0.1",
        "title": "Automaatti K-Citymarket Nummela",
        "street_address": "Tuusankaari 1",
        "country": "FI",
        "postcode": "03100",
        "carrier": "matkahuolto",
        "city": "Nummela",
        "id": "6277"
      },
      "id": 242119
    },
    {
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}",
      "id": 242120
    }
  ],
  "date_created_gmt": "2021-10-04T13:08:10",
  "date_paid_gmt": "2021-10-04T13:09:38",
  "total_tax": "3.97",
  "transaction_id": "b9b5739bc0",
  "line_items": [
    {
      "tax_class": "",
      "subtotal_tax": "2.52",
      "sku": "RE_LASERA20B0267",
      "taxes": [
        {
          "total": "2.5152",
          "subtotal": "2.5152",
          "id": 1
        }
      ],
      "subtotal": "10.48",
      "meta_data": [],
      "variation_id": 0,
      "price": 10.48,
      "product_id": 2149,
      "total_tax": "2.52",
      "name": "Serafil 20 Beige 0267 WR",
      "total": "10.48",
      "quantity": 1,
      "id": 7280
    }
  ],
  "date_completed": "2021-10-08T07:01:57",
  "discount_total": "0.00",
  "date_paid": "2021-10-04T16:09:38",
  "discount_tax": "0.00",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "payment_method_title": "Paytrail",
  "fee_lines": [],
  "shipping": {
    "state": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "company": "",
    "address_2": "",
    "last_name": "Rautiainen",
    "country": "FI",
    "postcode": "04109",
    "first_name": "Olli",
    "city": "Nummela"
  },
  "order_key": "wc_order_5u5kiQdAERF01",
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ]
  },
  "created_via": "checkout",
  "payment_method": "paytrail",
  "customer_id": 0,
  "billing": {
    "state": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "company": "",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "phone": "0407460885",
    "country": "FI",
    "email": "orau@windowslive.com",
    "postcode": "04109",
    "address_2": "",
    "city": "Nummela"
  },
  "id": 5911
}', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.164133.pi001.so_  zzy9f84d896921dcrr', 'K', 3.97)
'
 	23.1.2022 	16:41:33 	_lx_ExecuteSqlNew 	(5. palvelin)

warning: 
*** sql error: 4d execute sql error -1: Error -1, Duplicated key: 5911 on field Sales_Order_ID of table Sales_Order (dbmg 1115)
Cannot update new record in table Sales_Order of database Manageri_v19 (dbmg 1247)
Cannot save new record in table Sales_Order of database Manageri_v19 (dbmg 1248)
Failed to execute INSERT command. (SQLS 1802)
Failed to execute INSERT command. (dbmg 1248)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "status": "completed",
  "date_modified_gmt": "2021-10-08T04:01:57",
  "shipping_total": "6.05",
  "shipping_tax": "1.45",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "tax_lines": [
    {
      "rate_id": 1,
      "compound": false,
      "tax_total": "2.52",
      "shipping_tax_total": "1.45",
      "rate_code": "FI-ALV.-1",
      "id": 7282,
      "meta_data": [],
      "label": "alv."
    }
  ],
  "version": "3.6.2",
  "parent_id": 0,
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "currency": "EUR",
  "date_modified": "2021-10-08T07:01:57",
  "date_created": "2021-10-04T16:08:10",
  "total": "20.50",
  "refunds": [],
  "coupon_lines": [],
  "customer_note": "",
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "method_title": "Matkahuolto Lähellä-paketti",
      "total_tax": "1.45",
      "instance_id": "5",
      "taxes": [
        {
          "total": "1.452",
          "subtotal": "",
          "id": 1
        }
      ],
      "total": "6.05",
      "meta_data": [
        {
          "key": "Tuotteet",
          "value": "Serafil 20 Beige 0267 WR &times; 1",
          "id": 53885
        }
      ],
      "id": 7281
    }
  ],
  "date_completed_gmt": "2021-10-08T04:01:57",
  "number": "5911",
  "cart_tax": "2.52",
  "meta_data": [
    {
      "key": "is_vat_exempt",
      "value": "no",
      "id": 241915
    },
    {
      "key": "_woo_carrier_agent_id",
      "value": "6277",
      "id": 242117
    },
    {
      "key": "_woo_carrier_agent_meta",
      "value": {
        "street_address2": "",
        "logo_url": "",
        "distance": "0.1",
        "title": "Automaatti K-Citymarket Nummela",
        "street_address": "Tuusankaari 1",
        "country": "FI",
        "postcode": "03100",
        "carrier": "matkahuolto",
        "city": "Nummela",
        "id": "6277"
      },
      "id": 242119
    },
    {
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}",
      "id": 242120
    }
  ],
  "date_created_gmt": "2021-10-04T13:08:10",
  "date_paid_gmt": "2021-10-04T13:09:38",
  "total_tax": "3.97",
  "transaction_id": "b9b5739bc0",
  "line_items": [
    {
      "tax_class": "",
      "subtotal_tax": "2.52",
      "sku": "RE_LASERA20B0267",
      "taxes": [
        {
          "total": "2.5152",
          "subtotal": "2.5152",
          "id": 1
        }
      ],
      "subtotal": "10.48",
      "meta_data": [],
      "variation_id": 0,
      "price": 10.48,
      "product_id": 2149,
      "total_tax": "2.52",
      "name": "Serafil 20 Beige 0267 WR",
      "total": "10.48",
      "quantity": 1,
      "id": 7280
    }
  ],
  "date_completed": "2021-10-08T07:01:57",
  "discount_total": "0.00",
  "date_paid": "2021-10-04T16:09:38",
  "discount_tax": "0.00",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "payment_method_title": "Paytrail",
  "fee_lines": [],
  "shipping": {
    "state": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "company": "",
    "address_2": "",
    "last_name": "Rautiainen",
    "country": "FI",
    "postcode": "04109",
    "first_name": "Olli",
    "city": "Nummela"
  },
  "order_key": "wc_order_5u5kiQdAERF01",
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ]
  },
  "created_via": "checkout",
  "payment_method": "paytrail",
  "customer_id": 0,
  "billing": {
    "state": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "company": "",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "phone": "0407460885",
    "country": "FI",
    "email": "orau@windowslive.com",
    "postcode": "04109",
    "address_2": "",
    "city": "Nummela"
  },
  "id": 5911
}', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.164133.pi001.so_  zzy9f84d896921dcrr', 'K', 3.97) 
INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "status": "completed",
  "date_modified_gmt": "2021-10-08T04:01:57",
  "shipping_total": "6.05",
  "shipping_tax": "1.45",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "tax_lines": [
    {
      "rate_id": 1,
      "compound": false,
      "tax_total": "2.52",
      "shipping_tax_total": "1.45",
      "rate_code": "FI-ALV.-1",
      "id": 7282,
      "meta_data": [],
      "label": "alv."
    }
  ],
  "version": "3.6.2",
  "parent_id": 0,
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "currency": "EUR",
  "date_modified": "2021-10-08T07:01:57",
  "date_created": "2021-10-04T16:08:10",
  "total": "20.50",
  "refunds": [],
  "coupon_lines": [],
  "customer_note": "",
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "method_title": "Matkahuolto Lähellä-paketti",
      "total_tax": "1.45",
      "instance_id": "5",
      "taxes": [
        {
          "total": "1.452",
          "subtotal": "",
          "id": 1
        }
      ],
      "total": "6.05",
      "meta_data": [
        {
          "key": "Tuotteet",
          "value": "Serafil 20 Beige 0267 WR &times; 1",
          "id": 53885
        }
      ],
      "id": 7281
    }
  ],
  "date_completed_gmt": "2021-10-08T04:01:57",
  "number": "5911",
  "cart_tax": "2.52",
  "meta_data": [
    {
      "key": "is_vat_exempt",
      "value": "no",
      "id": 241915
    },
    {
      "key": "_woo_carrier_agent_id",
      "value": "6277",
      "id": 242117
    },
    {
      "key": "_woo_carrier_agent_meta",
      "value": {
        "street_address2": "",
        "logo_url": "",
        "distance": "0.1",
        "title": "Automaatti K-Citymarket Nummela",
        "street_address": "Tuusankaari 1",
        "country": "FI",
        "postcode": "03100",
        "carrier": "matkahuolto",
        "city": "Nummela",
        "id": "6277"
      },
      "id": 242119
    },
    {
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}",
      "id": 242120
    }
  ],
  "date_created_gmt": "2021-10-04T13:08:10",
  "date_paid_gmt": "2021-10-04T13:09:38",
  "total_tax": "3.97",
  "transaction_id": "b9b5739bc0",
  "line_items": [
    {
      "tax_class": "",
      "subtotal_tax": "2.52",
      "sku": "RE_LASERA20B0267",
      "taxes": [
        {
          "total": "2.5152",
          "subtotal": "2.5152",
          "id": 1
        }
      ],
      "subtotal": "10.48",
      "meta_data": [],
      "variation_id": 0,
      "price": 10.48,
      "product_id": 2149,
      "total_tax": "2.52",
      "name": "Serafil 20 Beige 0267 WR",
      "total": "10.48",
      "quantity": 1,
      "id": 7280
    }
  ],
  "date_completed": "2021-10-08T07:01:57",
  "discount_total": "0.00",
  "date_paid": "2021-10-04T16:09:38",
  "discount_tax": "0.00",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "payment_method_title": "Paytrail",
  "fee_lines": [],
  "shipping": {
    "state": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "company": "",
    "address_2": "",
    "last_name": "Rautiainen",
    "country": "FI",
    "postcode": "04109",
    "first_name": "Olli",
    "city": "Nummela"
  },
  "order_key": "wc_order_5u5kiQdAERF01",
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ]
  },
  "created_via": "checkout",
  "payment_method": "paytrail",
  "customer_id": 0,
  "billing": {
    "state": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "company": "",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "phone": "0407460885",
    "country": "FI",
    "email": "orau@windowslive.com",
    "postcode": "04109",
    "address_2": "",
    "city": "Nummela"
  },
  "id": 5911
}', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.164133.pi001.so_  zzy9f84d896921dcrr', 'K', 3.97)


. 	23.1.2022 	16:41:33 	lx 	(5. palvelin)

4d execute sql error -1: Error -1, Duplicated key: 5911 on field Sales_Order_ID of table Sales_Order (dbmg 1115)
Cannot update new record in table Sales_Order of database Manageri_v19 (dbmg 1247)
Cannot save new record in table Sales_Order of database Manageri_v19 (dbmg 1248)
Failed to execute INSERT command. (SQLS 1802)
Failed to execute INSERT command. (dbmg 1248)

INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "status": "completed",
  "date_modified_gmt": "2021-10-08T04:01:57",
  "shipping_total": "6.05",
  "shipping_tax": "1.45",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "tax_lines": [
    {
      "rate_id": 1,
      "compound": false,
      "tax_total": "2.52",
      "shipping_tax_total": "1.45",
      "rate_code": "FI-ALV.-1",
      "id": 7282,
      "meta_data": [],
      "label": "alv."
    }
  ],
  "version": "3.6.2",
  "parent_id": 0,
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "currency": "EUR",
  "date_modified": "2021-10-08T07:01:57",
  "date_created": "2021-10-04T16:08:10",
  "total": "20.50",
  "refunds": [],
  "coupon_lines": [],
  "customer_note": "",
  "shipping_lines": [
    {
      "method_id": "matkahuolto",
      "method_title": "Matkahuolto Lähellä-paketti",
      "total_tax": "1.45",
      "instance_id": "5",
      "taxes": [
        {
          "total": "1.452",
          "subtotal": "",
          "id": 1
        }
      ],
      "total": "6.05",
      "meta_data": [
        {
          "key": "Tuotteet",
          "value": "Serafil 20 Beige 0267 WR &times; 1",
          "id": 53885
        }
      ],
      "id": 7281
    }
  ],
  "date_completed_gmt": "2021-10-08T04:01:57",
  "number": "5911",
  "cart_tax": "2.52",
  "meta_data": [
    {
      "key": "is_vat_exempt",
      "value": "no",
      "id": 241915
    },
    {
      "key": "_woo_carrier_agent_id",
      "value": "6277",
      "id": 242117
    },
    {
      "key": "_woo_carrier_agent_meta",
      "value": {
        "street_address2": "",
        "logo_url": "",
        "distance": "0.1",
        "title": "Automaatti K-Citymarket Nummela",
        "street_address": "Tuusankaari 1",
        "country": "FI",
        "postcode": "03100",
        "carrier": "matkahuolto",
        "city": "Nummela",
        "id": "6277"
      },
      "id": 242119
    },
    {
      "key": "_wc_matkahuolto",
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}",
      "id": 242120
    }
  ],
  "date_created_gmt": "2021-10-04T13:08:10",
  "date_paid_gmt": "2021-10-04T13:09:38",
  "total_tax": "3.97",
  "transaction_id": "b9b5739bc0",
  "line_items": [
    {
      "tax_class": "",
      "subtotal_tax": "2.52",
      "sku": "RE_LASERA20B0267",
      "taxes": [
        {
          "total": "2.5152",
          "subtotal": "2.5152",
          "id": 1
        }
      ],
      "subtotal": "10.48",
      "meta_data": [],
      "variation_id": 0,
      "price": 10.48,
      "product_id": 2149,
      "total_tax": "2.52",
      "name": "Serafil 20 Beige 0267 WR",
      "total": "10.48",
      "quantity": 1,
      "id": 7280
    }
  ],
  "date_completed": "2021-10-08T07:01:57",
  "discount_total": "0.00",
  "date_paid": "2021-10-04T16:09:38",
  "discount_tax": "0.00",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "payment_method_title": "Paytrail",
  "fee_lines": [],
  "shipping": {
    "state": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "company": "",
    "address_2": "",
    "last_name": "Rautiainen",
    "country": "FI",
    "postcode": "04109",
    "first_name": "Olli",
    "city": "Nummela"
  },
  "order_key": "wc_order_5u5kiQdAERF01",
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ]
  },
  "created_via": "checkout",
  "payment_method": "paytrail",
  "customer_id": 0,
  "billing": {
    "state": "",
    "address_1": "Hopeasepäntie 9 as 3",
    "company": "",
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "phone": "0407460885",
    "country": "FI",
    "email": "orau@windowslive.com",
    "postcode": "04109",
    "address_2": "",
    "city": "Nummela"
  },
  "id": 5911
}', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.164133.pi001.so_  zzy9f84d896921dcrr', 'K', 3.97). 	23.1.2022 	16:41:33 	_lx_SERVER 	(5. palvelin)

4D: SELECT so.record_id FROM sales_order so WHERE so.project_id <> '' LIMIT 500 INTO :_lx_atExe1
 - original query: SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id FROM sales_order so  WHERE so.project_id <> ''  ORDER BY so.sales_order_id DESC  LIMIT 500  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8
 - result _lx_atExe1 size: 500, first value: '2001066'
 - query name: new:form/nc/erp-sync/woocommerce/query-local/order-sales.json. 	23.1.2022 	16:41:46 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 43, send count: 5, loop count: 4, bytes sent 341127 / 341127, 0 remaining, total send time 6 µs. 	23.1.2022 	16:41:46 	lx 	(5. palvelin)

Aluetta ei löytynyt: 268435457. 	23.1.2022 	16:43:07 	_alp SEL_GET 	(9. Preference)

Aluetta ei löytynyt. 	23.1.2022 	16:43:07 	_alp ArrSize 	(9. Preference)

*** tcp close for sock 72, type 'nil', protocol 'nil', reason: '', request length: (no request) bytes ***. 	23.1.2022 	16:43:07 	lx 	(5. palvelin)

closing socket '72'. 	23.1.2022 	16:43:07 	lx 	(5. palvelin)

*** tcp close for sock 73, type 'nil', protocol 'nil', reason: '', request length: (no request) bytes ***. 	23.1.2022 	16:43:07 	lx 	(5. palvelin)

closing socket '73'. 	23.1.2022 	16:43:07 	lx 	(5. palvelin)

 -- Server statistics --
answerCount:          43
poll.fd_count:        1
pollCount:            62504
pollInCount:          48
pollOutCount:         0
pollCloseCount:       4
pollErrCount:         0
fd add/remove count:  7/6
totalBytesReceived:   59786
totalBytesSent:       787710. 	23.1.2022 	16:43:07 	lx 	(5. palvelin)

warning: socket type 'number' is not a table, socket number: 77
. 	23.1.2022 	16:43:07 	lx 	(5. palvelin)

closing socket '77'. 	23.1.2022 	16:43:07 	lx 	(5. palvelin)

poll.expand_fds, free old fds: cdata<struct pollfd *>: 0x012e64b750. 	23.1.2022 	16:43:07 	lx 	(5. palvelin)

poll.expand_fds: 50, old fds: nil, new fds: cdata<struct pollfd *>: 0x012e64b750, size: 400. 	23.1.2022 	16:43:07 	lx 	(5. palvelin)

--- server stopped ---. 	23.1.2022 	16:43:07 	lx 	(5. palvelin)

finalizer: free p1 	 cdata<void *>: 0x012e64b750. 	23.1.2022 	16:43:08 	lx 	(5. palvelin)

* run in command line: 'LC_ALL=C ifconfig en0 | awk '/ether/{print $2}''. 	23.1.2022 	16:43:48 	lx 	(1. Application process)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/table/db_connection_preference.json'. 	23.1.2022 	16:43:48 	lx 	(1. Application process)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/preference/auth/connection.json'. 	23.1.2022 	16:43:48 	lx 	(1. Application process)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/.nc-env.json'. 	23.1.2022 	16:43:48 	lx 	(1. Application process)

    Connected to: 'postgre local socket, /tmp, database: fi_demo, user: manage_demo'. 	23.1.2022 	16:43:48 	lx 	(1. Application process)

  database connect time: 0.0002 seconds. 	23.1.2022 	16:43:48 	lx 	(1. Application process)

* connect: connection changed to 'postgre-demo/fi_demo'. 	23.1.2022 	16:43:48 	lx 	(1. Application process)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/preference/table/prf/group.json'. 	23.1.2022 	16:43:48 	lx 	(1. Application process)

* preference 'system/nc_server_start.json' was loaded from database 'postgre local socket, /tmp, database: fi_demo, user: manage_demo'. 	23.1.2022 	16:43:48 	lx 	(1. Application process)

Käynnisteään Tcp palvelin 2. 	23.1.2022 	16:43:48 	_lx_SERVER 	(5. palvelin)

* run in command line: 'LC_ALL=C ifconfig en0 | awk '/ether/{print $2}''. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/table/db_connection_preference.json'. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/preference/auth/connection.json'. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/.nc-env.json'. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

    Connected to: 'postgre local socket, /tmp, database: fi_demo, user: manage_demo'. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

  database connect time: 0.0002 seconds. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

* connect: connection changed to 'postgre-demo/fi_demo'. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

* paths:
 - main: '/Users/pasi/nc/nc-server/'
 - bin : '/Users/pasi/4D/mg_v19/Manageri_v19/Resources/bin/bin_osx_arm64/'
 - pref: '/Users/pasi/nc/nc-server/preference/'
 - 4D  : '/Users/pasi/4D/mg_v19/Manageri_v19/'
. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/preference/table/prf/group.json'. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

poll.expand_fds: 50, old fds: nil, new fds: cdata<struct pollfd *>: 0x011decd160, size: 400. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

********************* /Users/pasi/nc/nc-server/ *********************. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

port: 5949, arguments: '[
	5949
]', nc-server.json: '[]'. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

nc_server: debugLevel(0):0  port(5959):5949  closeConnection(0):0. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

1. Loading plugin: nc/worker/auth_worker. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

2. Loading plugin: nc/worker/query_worker. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

3. Loading plugin: nc/worker/query4d_worker. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

4. Loading plugin: nc/worker/call4d_worker. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

All plugins have been loaded. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

* cached preference files: demo-fi_demo-0 - system/option.json, demo-fi_demo-0 - table/prf/field_type.json, demo-fi_demo-0 - system/4d.json. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

* run in command line: 'ifconfig | grep -E 'inet.[0-9]' | grep -v '127.0.0.1' | awk '{ print $2}''. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

* run in command line: 'LC_ALL=C ifconfig en0 | awk '/ether/{print $2}''. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

Mac address: f84d896921dc. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

TLS certificate files: /Users/pasi/nc/nc-server/preference/cert/cert.pem, /Users/pasi/nc/nc-server/preference/cert/privkey.pem. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

NC tcp server waiting on:  http://127.0.0.1:5949/,  http://192.168.32.2:5949/
                          https://127.0.0.1:5949/, https://192.168.32.2:5949/. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

NC udp server waiting on: 127.0.0.1:5949/, 192.168.32.2:5949/. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

--- server started in 0.0018 seconds, 2022-01-23 16:43:50, used memory 3039.2 kb --- 	 5. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

OSX arm64, using: rapidjson-arm, lfs-ffi. 	23.1.2022 	16:43:50 	lx 	(5. palvelin)

1. uri: HTTP, POST '/rest/nc/query/sql4d' 2022-01-23 16:44:00
'POST /rest/nc/query/sql4d HTTP/1.1
Content-Type: application/json
Connection: keep-alive
User-Agent: nc-rest-sql
Authorization: Basic ???
Content-Encoding: lz4
Accept-Encoding: lz4
Content-Length: 918
Content-Uncompressed-Length: 1429

LZ4. 	23.1.2022 	16:44:00 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/.nc-env.json'. 	23.1.2022 	16:44:00 	lx 	(5. palvelin)

    Connected to: 'Manageri v12 plg4d local, , database: plg4d, user: manage_demo'. 	23.1.2022 	16:44:00 	lx 	(5. palvelin)

  database connect time: 0.0011 seconds. 	23.1.2022 	16:44:00 	lx 	(5. palvelin)

* connect: connection changed from 'postgre-demo/fi_demo' to 'plg4d/plg4d'. 	23.1.2022 	16:44:00 	lx 	(5. palvelin)

4D: SELECT inv.record_id FROM invoice inv WHERE inv.company_id IN ('1057') INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv  WHERE inv.company_id IN ('1057')  ORDER BY inv.invoice_id  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
 - result _lx_atExe1 size: 127, first value: '1300969'
 - query name: new:form/nc/erp-sync/query/order-invoice.json. 	23.1.2022 	16:44:00 	_lx_ExecuteSqlNew 	(5. palvelin)

 1. answer time: 00:00:00.00355
  
SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id
 FROM invoice inv
 WHERE inv.company_id IN ('1057')
 ORDER BY inv.invoice_id. 	23.1.2022 	16:44:00 	lx 	(5. palvelin)

4D: SELECT inv.record_id FROM invoice inv WHERE inv.company_id IN ('1057') INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv  WHERE inv.company_id IN ('1057')  ORDER BY inv.invoice_id  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
 - result _lx_atExe1 size: 127, first value: '1300969'
 - query name: new:form/nc/erp-sync/query/order-invoice.json. 	23.1.2022 	16:44:00 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT inv.record_id FROM invoice inv WHERE inv.company_id IN ('1057') INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv  WHERE inv.company_id IN ('1057')  ORDER BY inv.invoice_id  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
 - result _lx_atExe1 size: 127, first value: '1300969'
 - query name: new:form/nc/erp-sync/query/order-invoice.json. 	23.1.2022 	16:44:00 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT so.record_id FROM sales_order so WHERE so.project_id <> '' LIMIT 500 INTO :_lx_atExe1
 - original query: SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id FROM sales_order so  WHERE so.project_id <> ''  ORDER BY so.sales_order_id DESC  LIMIT 500  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8
 - result _lx_atExe1 size: 500, first value: '2001066'
 - query name: new:form/nc/erp-sync/woocommerce/query-local/order-sales.json. 	23.1.2022 	16:44:04 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 4, send count: 5, loop count: 4, bytes sent 341431 / 341431, 0 remaining, total send time 111 µs. 	23.1.2022 	16:44:04 	lx 	(5. palvelin)

4D: SELECT so.record_id FROM sales_order so WHERE so.project_id <> '' LIMIT 500 INTO :_lx_atExe1
 - original query: SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id FROM sales_order so  WHERE so.project_id <> ''  ORDER BY so.sales_order_id DESC  LIMIT 500  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8
 - result _lx_atExe1 size: 500, first value: '2001066'
 - query name: new:form/nc/erp-sync/woocommerce/query-local/order-sales.json. 	23.1.2022 	16:44:05 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 5, send result: -1, send count: 1, loop count: 1, bytes sent 81660 / 341431, 259771 remaining, total send time 85 µs. 	23.1.2022 	16:44:05 	lx 	(5. palvelin)

 -- tcp answer 5, send result: -1, send count: 2, loop count: 3, bytes sent 163320 / 341431, 178111 remaining, total send time 1344 µs. 	23.1.2022 	16:44:05 	lx 	(5. palvelin)

 -- tcp answer 5, send result: -1, send count: 3, loop count: 5, bytes sent 244980 / 341431, 96451 remaining, total send time 2583 µs. 	23.1.2022 	16:44:05 	lx 	(5. palvelin)

 -- tcp answer 5, send result: -1, send count: 4, loop count: 7, bytes sent 326640 / 341431, 14791 remaining, total send time 3854 µs. 	23.1.2022 	16:44:05 	lx 	(5. palvelin)

 -- tcp answer 5, send count: 5, loop count: 8, bytes sent 341431 / 341431, 0 remaining, total send time 5114 µs. 	23.1.2022 	16:44:05 	lx 	(5. palvelin)

4D: SELECT _prf.record_id FROM _preference _prf WHERE name_id = '_code_SiteCode' INTO :_lx_atExe1
 - original query: SELECT text_value FROM _preference WHERE name_id = '_code_SiteCode'  INTO :_lx_atExe1
 - result _lx_atExe1 size: 1, first value: 'ZZY0'
 - query name: new:dsql.sqlExecuteUnsafe. 	23.1.2022 	16:44:21 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT _prf.record_id FROM _preference _prf WHERE name_id = 'code_default.json' INTO :_lx_atExe1
 - original query: SELECT text_value FROM _preference WHERE name_id = 'code_default.json'  INTO :_lx_atExe1
 - result _lx_atExe1 size: 1, first value: '{
  "code": {
    "_CODE_ALFLD": [4002, 4002, 4002, 4013, 4013, 4013, 8011, 8011, 10004, 11005, 17004, 17004, 17004, 17004, 17004, 17004, 21001, 21001, 21001, 21001, 21001, 21001, 26002, 27001, 28008, 28008, 29001, 29001, 31001, 31001, 31011, 32002, 32002, 33001, 37001, 37001, 42001, 43002, 44012, 44031, 44031, 44032, 48036, 50001, 54001],
    "_CODE_ASFLDNAME": ["[Tosite]TUNNUS", "[Tosite]Tosite ID", "[Tosite]TUNNUS", "[Tosite]Tositenumero", "[Tosite]Tositenumero", "[Tosite]Tositenumero", "[Var'
 - query name: new:dsql.sqlExecuteUnsafe. 	23.1.2022 	16:44:21 	_lx_ExecuteSqlNew 	(5. palvelin)

warning: 
*** sql error: '', sql: 
INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti S-Market Kontula
Ostostie 4
00940 HELSINKI', '7000', 'Armassalo Kyösti
Rekipellontie 10.D.30
00940 Helsinki
+358505148169, kyosti.armassalo@kolumbus.fi', '7000', '{
  "date_paid_gmt": "2021-10-05T09:53:12",
  "date_completed": "2021-10-08T06:57:12",
  "date_created": "2021-10-05T12:51:52",
  "cart_hash": "91ac366c989c721d24280031aaabaa60",
  "id": 5914,
  "meta_data": [
    {
      "key": "is_vat_exempt",
      "id": 241956,
      "value": "no"
    },
    {
      "key": "_woo_carrier_agent_id",
      "id": 241957,
      "value": "6535"
    },
    {
      "key": "_woo_carrier_agent_meta",
      "id": 241958,
      "value": {
        "distance": "0.4",
        "title": "Automaatti S-Market Kontula",
        "carrier": "matkahuolto",
        "logo_url": "",
        "id": "6535",
        "street_address": "Ostostie 4",
        "country": "FI",
        "city": "HELSINKI",
        "postcode": "00940",
        "street_address2": ""
      }
    },
    {
      "key": "_wc_matkahuolto",
      "id": 242107,
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496270FI\";s:6:\"weight\";d:0.90000000000000002220446049250313080847263336181640625;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}"
    }
  ],
  "customer_note": "",
  "line_items": [
    {
      "product_id": 2207,
      "id": 7283,
      "price": 0.48387,
      "meta_data": [],
      "tax_class": "",
      "total": "24.19",
      "total_tax": "5.81",
      "variation_id": 0,
      "subtotal": "24.19",
      "subtotal_tax": "5.81",
      "taxes": [
        {
          "id": 1,
          "subtotal": "5.80644",
          "total": "5.80644"
        }
      ],
      "quantity": 50,
      "sku": "WE_RE_KANACSVA",
      "name": "Valkoinen kanttinauha"
    },
    {
      "product_id": 2182,
      "id": 7284,
      "price": 32.26,
      "meta_data": [],
      "tax_class": "",
      "total": "32.26",
      "total_tax": "7.74",
      "variation_id": 0,
      "subtotal": "32.26",
      "subtotal_tax": "7.74",
      "taxes": [
        {
          "id": 1,
          "subtotal": "7.7424",
          "total": "7.7424"
        }
      ],
      "quantity": 1,
      "sku": "RE_LARAW35V",
      "name": "Rasant 35 WR Luonnonvalkoinen 3000"
    }
  ],
  "shipping_lines": [
    {
      "total_tax": "1.84",
      "method_title": "Matkahuolto Lähellä-paketti",
      "total": "7.66",
      "method_id": "matkahuolto",
      "instance_id": "5",
      "taxes": [
        {
          "id": 1,
          "subtotal": "",
          "total": "1.8384"
        }
      ],
      "id": 7285,
      "meta_data": [
        {
          "key": "Tuotteet",
          "id": 53914,
          "value": "Valkoinen kanttinauha &times; 50, Rasant 35 WR Luonnonvalkoinen 3000 &times; 1"
        }
      ]
    }
  ],
  "order_key": "wc_order_sossRAMTkHUTY",
  "created_via": "checkout",
  "date_created_gmt": "2021-10-05T09:51:52",
  "currency": "EUR",
  "discount_tax": "0.00",
  "shipping_total": "7.66",
  "shipping_tax": "1.84",
  "cart_tax": "13.55",
  "status": "completed",
  "date_modified": "2021-10-08T06:57:12",
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "customer_id": 0,
  "customer_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36 Edg/94.0.992.38",
  "billing": {
    "address_1": "Rekipellontie 10.D.30",
    "phone": "+358505148169",
    "address_2": "",
    "email": "kyosti.armassalo@kolumbus.fi",
    "postcode": "00940",
    "country": "FI",
    "company": "",
    "city": "Helsinki",
    "state": "",
    "first_name": "Kyösti",
    "last_name": "Armassalo"
  },
  "payment_method_title": "Paytrail",
  "tax_lines": [
    {
      "shipping_tax_total": "1.84",
      "tax_total": "13.55",
      "id": 7286,
      "rate_code": "FI-ALV.-1",
      "label": "alv.",
      "rate_id": 1,
      "compound": false,
      "meta_data": []
    }
  ],
  "shipping": {
    "address_1": "Rekipellontie 10.D.30",
    "address_2": "",
    "postcode": "00940",
    "state": "",
    "company": "",
    "city": "Helsinki",
    "country": "FI",
    "first_name": "Kyösti",
    "last_name": "Armassalo"
  },
  "parent_id": 0,
  "transaction_id": "34ef06465f",
  "number": "5914",
  "total_tax": "15.39",
  "date_modified_gmt": "2021-10-08T03:57:12",
  "date_completed_gmt": "2021-10-08T03:57:12",
  "total": "79.50",
  "fee_lines": [],
  "coupon_lines": [],
  "refunds": [],
  "_links": {
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5914"
      }
    ],
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ]
  },
  "version": "3.6.2",
  "discount_total": "0.00",
  "payment_method": "paytrail",
  "date_paid": "2021-10-05T12:53:12"
}', '', 'Armassalo Kyösti
Rekipellontie 10.D.30
00940 Helsinki', '5914', 'AV', 'TI', 'HV', 64.11, '', '20220123.164421.qs001.so_  zzy9f84d896921dcrr', 'K', 15.39)


. 	23.1.2022 	16:44:22 	lx 	(5. palvelin)

4D: SELECT so.record_id FROM sales_order so WHERE so.project_id <> '' LIMIT 500 INTO :_lx_atExe1
 - original query: SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id FROM sales_order so  WHERE so.project_id <> ''  ORDER BY so.sales_order_id DESC  LIMIT 500  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8
 - result _lx_atExe1 size: 500, first value: '2001066'
 - query name: new:form/nc/erp-sync/woocommerce/query-local/order-sales.json. 	23.1.2022 	16:44:22 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 9, send result: -1, send count: 1, loop count: 1, bytes sent 81660 / 341431, 259771 remaining, total send time 1 µs. 	23.1.2022 	16:44:22 	lx 	(5. palvelin)

 -- tcp answer 9, send result: -1, send count: 2, loop count: 3, bytes sent 163320 / 341431, 178111 remaining, total send time 1260 µs. 	23.1.2022 	16:44:23 	lx 	(5. palvelin)

 -- tcp answer 9, send result: -1, send count: 3, loop count: 5, bytes sent 244980 / 341431, 96451 remaining, total send time 2500 µs. 	23.1.2022 	16:44:23 	lx 	(5. palvelin)

 -- tcp answer 9, send result: -1, send count: 4, loop count: 7, bytes sent 326640 / 341431, 14791 remaining, total send time 3745 µs. 	23.1.2022 	16:44:23 	lx 	(5. palvelin)

 -- tcp answer 9, send count: 5, loop count: 8, bytes sent 341431 / 341431, 0 remaining, total send time 5344 µs. 	23.1.2022 	16:44:23 	lx 	(5. palvelin)

warning: 
*** sql error: '', sql: 
INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "order_key": "wc_order_5u5kiQdAERF01",
  "created_via": "checkout",
  "date_modified": "2021-10-08T07:01:57",
  "date_created": "2021-10-04T16:08:10",
  "id": 5911,
  "discount_tax": "0.00",
  "shipping_total": "6.05",
  "shipping_tax": "1.45",
  "cart_tax": "2.52",
  "customer_note": "",
  "prices_include_tax": false,
  "line_items": [
    {
      "product_id": 2149,
      "id": 7280,
      "price": 10.48,
      "meta_data": [],
      "tax_class": "",
      "total": "10.48",
      "total_tax": "2.52",
      "variation_id": 0,
      "subtotal": "10.48",
      "subtotal_tax": "2.52",
      "taxes": [
        {
          "id": 1,
          "subtotal": "2.5152",
          "total": "2.5152"
        }
      ],
      "quantity": 1,
      "sku": "RE_LASERA20B0267",
      "name": "Serafil 20 Beige 0267 WR"
    }
  ],
  "shipping_lines": [
    {
      "total_tax": "1.45",
      "total": "6.05",
      "method_title": "Matkahuolto Lähellä-paketti",
      "method_id": "matkahuolto",
      "id": 7281,
      "meta_data": [
        {
          "key": "Tuotteet",
          "id": 53885,
          "value": "Serafil 20 Beige 0267 WR &times; 1"
        }
      ],
      "instance_id": "5",
      "taxes": [
        {
          "id": 1,
          "subtotal": "",
          "total": "1.452"
        }
      ]
    }
  ],
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "coupon_lines": [],
  "fee_lines": [],
  "tax_lines": [
    {
      "shipping_tax_total": "1.45",
      "compound": false,
      "rate_code": "FI-ALV.-1",
      "tax_total": "2.52",
      "label": "alv.",
      "meta_data": [],
      "id": 7282,
      "rate_id": 1
    }
  ],
  "currency": "EUR",
  "date_completed_gmt": "2021-10-08T04:01:57",
  "date_completed": "2021-10-08T07:01:57",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "meta_data": [
    {
      "key": "is_vat_exempt",
      "id": 241915,
      "value": "no"
    },
    {
      "key": "_woo_carrier_agent_id",
      "id": 242117,
      "value": "6277"
    },
    {
      "key": "_woo_carrier_agent_meta",
      "id": 242119,
      "value": {
        "logo_url": "",
        "title": "Automaatti K-Citymarket Nummela",
        "id": "6277",
        "street_address": "Tuusankaari 1",
        "country": "FI",
        "distance": "0.1",
        "carrier": "matkahuolto",
        "postcode": "03100",
        "street_address2": "",
        "city": "Nummela"
      }
    },
    {
      "key": "_wc_matkahuolto",
      "id": 242120,
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}"
    }
  ],
  "status": "completed",
  "payment_method": "paytrail",
  "date_paid_gmt": "2021-10-04T13:09:38",
  "customer_id": 0,
  "payment_method_title": "Paytrail",
  "billing": {
    "phone": "0407460885",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "state": "",
    "city": "Nummela",
    "company": "",
    "email": "orau@windowslive.com",
    "country": "FI",
    "postcode": "04109",
    "first_name": "Olli",
    "last_name": "Rautiainen"
  },
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ]
  },
  "number": "5911",
  "date_paid": "2021-10-04T16:09:38",
  "transaction_id": "b9b5739bc0",
  "date_created_gmt": "2021-10-04T13:08:10",
  "total": "20.50",
  "total_tax": "3.97",
  "parent_id": 0,
  "shipping": {
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "state": "",
    "company": "",
    "city": "Nummela",
    "country": "FI",
    "postcode": "04109",
    "first_name": "Olli",
    "last_name": "Rautiainen"
  },
  "customer_ip_address": "185.166.28.117",
  "version": "3.6.2",
  "discount_total": "0.00",
  "refunds": [],
  "date_modified_gmt": "2021-10-08T04:01:57"
}', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.164449.hd002.so_  zzy9f84d896921dcrr', 'K', 3.97)


. 	23.1.2022 	16:44:49 	lx 	(5. palvelin)

4D: SELECT so.record_id FROM sales_order so WHERE so.project_id <> '' LIMIT 500 INTO :_lx_atExe1
 - original query: SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id FROM sales_order so  WHERE so.project_id <> ''  ORDER BY so.sales_order_id DESC  LIMIT 500  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8
 - result _lx_atExe1 size: 500, first value: '2001066'
 - query name: new:form/nc/erp-sync/woocommerce/query-local/order-sales.json. 	23.1.2022 	16:44:50 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 11, send result: -1, send count: 1, loop count: 1, bytes sent 81660 / 341431, 259771 remaining, total send time 1 µs. 	23.1.2022 	16:44:50 	lx 	(5. palvelin)

 -- tcp answer 11, send result: -1, send count: 2, loop count: 3, bytes sent 163320 / 341431, 178111 remaining, total send time 1251 µs. 	23.1.2022 	16:44:50 	lx 	(5. palvelin)

 -- tcp answer 11, send result: -1, send count: 3, loop count: 5, bytes sent 244980 / 341431, 96451 remaining, total send time 2476 µs. 	23.1.2022 	16:44:50 	lx 	(5. palvelin)

 -- tcp answer 11, send result: -1, send count: 4, loop count: 7, bytes sent 326640 / 341431, 14791 remaining, total send time 3723 µs. 	23.1.2022 	16:44:50 	lx 	(5. palvelin)

 -- tcp answer 11, send count: 5, loop count: 8, bytes sent 341431 / 341431, 0 remaining, total send time 5152 µs. 	23.1.2022 	16:44:50 	lx 	(5. palvelin)

warning: 
*** sql error: '', sql: 
INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Matkahuolto Värisilmä
Lautamiehentie 1 B
02770 Espoo', '7000', 'Valo Harri
Laudetie 1 c
02770 Espoo
0405012380, harri.valo@hotmail.com', '7000', '{
  "shipping_total": "7.66",
  "shipping_tax": "1.84",
  "cart_tax": "8.71",
  "date_created": "2021-10-03T19:12:28",
  "id": 5910,
  "prices_include_tax": false,
  "customer_ip_address": "185.166.28.117",
  "refunds": [],
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SM-G975F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Mobile Safari/537.36",
  "coupon_lines": [],
  "customer_note": "",
  "tax_lines": [
    {
      "shipping_tax_total": "1.84",
      "meta_data": [],
      "rate_code": "FI-ALV.-1",
      "tax_total": "8.71",
      "label": "alv.",
      "rate_id": 1,
      "id": 7279,
      "compound": false
    }
  ],
  "line_items": [
    {
      "product_id": 1058,
      "variation_id": 0,
      "price": 12.097,
      "id": 7276,
      "tax_class": "",
      "total": "12.10",
      "total_tax": "2.90",
      "meta_data": [],
      "subtotal": "12.10",
      "subtotal_tax": "2.90",
      "taxes": [
        {
          "id": 1,
          "subtotal": "2.90328",
          "total": "2.90328"
        }
      ],
      "quantity": 1,
      "sku": "RE_TEX_C",
      "name": "Tex''Aktiv clean, puhdistusaine, 1L"
    },
    {
      "product_id": 1057,
      "variation_id": 0,
      "price": 24.1934,
      "id": 7277,
      "tax_class": "",
      "total": "24.19",
      "total_tax": "5.81",
      "meta_data": [],
      "subtotal": "24.19",
      "subtotal_tax": "5.81",
      "taxes": [
        {
          "id": 1,
          "subtotal": "5.806416",
          "total": "5.806416"
        }
      ],
      "quantity": 1,
      "sku": "RE_TEX_G",
      "name": "Tex''Aktiv guard, kyllästysaine, 1L"
    }
  ],
  "date_paid_gmt": "2021-10-03T16:15:18",
  "date_completed": "2021-10-04T14:01:30",
  "date_completed_gmt": "2021-10-04T11:01:30",
  "cart_hash": "ad89e8a08ee3558aa16ecc01a99c7e66",
  "meta_data": [
    {
      "key": "is_vat_exempt",
      "id": 241852,
      "value": "no"
    },
    {
      "key": "_woo_carrier_agent_id",
      "id": 241853,
      "value": "2644"
    },
    {
      "key": "_woo_carrier_agent_meta",
      "id": 241854,
      "value": {
        "carrier": "matkahuolto",
        "postcode": "02770",
        "logo_url": "",
        "street_address": "Lautamiehentie 1 B",
        "country": "FI",
        "title": "Matkahuolto Värisilmä",
        "street_address2": "",
        "id": "2644",
        "distance": "1.7",
        "city": "Espoo"
      }
    },
    {
      "key": "_wc_matkahuolto",
      "id": 241874,
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH229047720FI\";s:6:\"weight\";d:2.399999999999999911182158029987476766109466552734375;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"10\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}"
    }
  ],
  "currency": "EUR",
  "_links": {
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5910"
      }
    ],
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ]
  },
  "status": "completed",
  "payment_method_title": "Paytrail",
  "payment_method": "paytrail",
  "date_paid": "2021-10-03T19:15:18",
  "customer_id": 0,
  "billing": {
    "phone": "0405012380",
    "postcode": "02770",
    "email": "harri.valo@hotmail.com",
    "state": "",
    "city": "Espoo",
    "company": "",
    "first_name": "Harri",
    "address_1": "Laudetie 1 c",
    "country": "FI",
    "address_2": "",
    "last_name": "Valo"
  },
  "shipping_lines": [
    {
      "total_tax": "1.84",
      "method_title": "Matkahuolto Bussipaketti",
      "meta_data": [
        {
          "key": "Tuotteet",
          "id": 53865,
          "value": "Tex''Aktiv clean, puhdistusaine, 1L &times; 1, Tex''Aktiv guard, kyllästysaine, 1L &times; 1"
        }
      ],
      "method_id": "matkahuolto",
      "taxes": [
        {
          "id": 1,
          "subtotal": "",
          "total": "1.8384"
        }
      ],
      "instance_id": "4",
      "id": 7278,
      "total": "7.66"
    }
  ],
  "parent_id": 0,
  "transaction_id": "afea43a350",
  "total": "54.50",
  "date_modified_gmt": "2021-10-04T11:01:30",
  "date_modified": "2021-10-04T14:01:30",
  "fee_lines": [],
  "order_key": "wc_order_aH7nC36pura8L",
  "total_tax": "10.55",
  "created_via": "checkout",
  "shipping": {
    "postcode": "02770",
    "state": "",
    "city": "Espoo",
    "company": "",
    "country": "FI",
    "address_1": "Laudetie 1 c",
    "address_2": "",
    "first_name": "Harri",
    "last_name": "Valo"
  },
  "date_created_gmt": "2021-10-03T16:12:28",
  "version": "3.6.2",
  "discount_total": "0.00",
  "number": "5910",
  "discount_tax": "0.00"
}', '', 'Valo Harri
Laudetie 1 c
02770 Espoo', '5910', 'AV', 'TI', 'HV', 43.95, '', '20220123.165131.7v003.so_  zzy9f84d896921dcrr', 'K', 10.55)


. 	23.1.2022 	16:51:31 	lx 	(5. palvelin)

4D: SELECT so.record_id FROM sales_order so WHERE so.project_id <> '' LIMIT 500 INTO :_lx_atExe1
 - original query: SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id FROM sales_order so  WHERE so.project_id <> ''  ORDER BY so.sales_order_id DESC  LIMIT 500  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8
 - result _lx_atExe1 size: 500, first value: '2001066'
 - query name: new:form/nc/erp-sync/woocommerce/query-local/order-sales.json. 	23.1.2022 	16:51:32 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 13, send result: -1, send count: 3, loop count: 3, bytes sent 244980 / 341431, 96451 remaining, total send time 3 µs. 	23.1.2022 	16:51:32 	lx 	(5. palvelin)

 -- tcp answer 13, send result: -1, send count: 4, loop count: 5, bytes sent 326640 / 341431, 14791 remaining, total send time 1246 µs. 	23.1.2022 	16:51:32 	lx 	(5. palvelin)

 -- tcp answer 13, send count: 5, loop count: 6, bytes sent 341431 / 341431, 0 remaining, total send time 2475 µs. 	23.1.2022 	16:51:32 	lx 	(5. palvelin)

*** tcp close for sock 77, type 'nil', protocol 'HTTP', reason: 'POLLHUP', request length: 1 087 bytes ***. 	23.1.2022 	18:33:00 	lx 	(5. palvelin)

closing socket '77'. 	23.1.2022 	18:33:00 	lx 	(5. palvelin)

*** tcp close for sock 77, type 'nil', protocol 'HTTP', reason: 'POLLHUP', request length: 576 bytes ***. 	23.1.2022 	19:08:42 	lx 	(5. palvelin)

closing socket '77'. 	23.1.2022 	19:08:42 	lx 	(5. palvelin)

*** tcp close for sock 72, type 'nil', protocol 'nil', reason: '', request length: (no request) bytes ***. 	23.1.2022 	23:23:01 	lx 	(5. palvelin)

closing socket '72'. 	23.1.2022 	23:23:01 	lx 	(5. palvelin)

*** tcp close for sock 73, type 'nil', protocol 'nil', reason: '', request length: (no request) bytes ***. 	23.1.2022 	23:23:01 	lx 	(5. palvelin)

closing socket '73'. 	23.1.2022 	23:23:01 	lx 	(5. palvelin)

 -- Server statistics --
answerCount:          16
poll.fd_count:        0
pollCount:            851544
pollInCount:          18
pollOutCount:         0
pollCloseCount:       2
pollErrCount:         0
fd add/remove count:  4/4
totalBytesReceived:   23642
totalBytesSent:       401430. 	23.1.2022 	23:23:01 	lx 	(5. palvelin)

--- server stopped ---. 	23.1.2022 	23:23:01 	lx 	(5. palvelin)

finalizer: free p1 	 cdata<void *>: 0x011decd160. 	23.1.2022 	23:23:01 	lx 	(5. palvelin)

* run in command line: 'LC_ALL=C ifconfig en0 | awk '/ether/{print $2}''. 	23.1.2022 	23:42:23 	lx 	(1. Application process)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/table/db_connection_preference.json'. 	23.1.2022 	23:42:23 	lx 	(1. Application process)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/preference/auth/connection.json'. 	23.1.2022 	23:42:23 	lx 	(1. Application process)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/.nc-env.json'. 	23.1.2022 	23:42:23 	lx 	(1. Application process)

    Connected to: 'postgre local socket, /tmp, database: fi_demo, user: manage_demo'. 	23.1.2022 	23:42:23 	lx 	(1. Application process)

  database connect time: 0.0009 seconds. 	23.1.2022 	23:42:23 	lx 	(1. Application process)

* connect: connection changed to 'postgre-demo/fi_demo'. 	23.1.2022 	23:42:23 	lx 	(1. Application process)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/preference/table/prf/group.json'. 	23.1.2022 	23:42:23 	lx 	(1. Application process)

* preference 'system/nc_server_start.json' was loaded from database 'postgre local socket, /tmp, database: fi_demo, user: manage_demo'. 	23.1.2022 	23:42:23 	lx 	(1. Application process)

Käynnisteään Tcp palvelin 2. 	23.1.2022 	23:42:23 	_lx_SERVER 	(5. palvelin)

* run in command line: 'LC_ALL=C ifconfig en0 | awk '/ether/{print $2}''. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/table/db_connection_preference.json'. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/preference/auth/connection.json'. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/.nc-env.json'. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

    Connected to: 'postgre local socket, /tmp, database: fi_demo, user: manage_demo'. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

  database connect time: 0.0003 seconds. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

* connect: connection changed to 'postgre-demo/fi_demo'. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

* paths:
 - main: '/Users/pasi/nc/nc-server/'
 - bin : '/Users/pasi/4D/mg_v19/Manageri_v19/Resources/bin/bin_osx_arm64/'
 - pref: '/Users/pasi/nc/nc-server/preference/'
 - 4D  : '/Users/pasi/4D/mg_v19/Manageri_v19/'
. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/preference/table/prf/group.json'. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

poll.expand_fds: 50, old fds: nil, new fds: cdata<struct pollfd *>: 0x013ff2c230, size: 400. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

********************* /Users/pasi/nc/nc-server/ *********************. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

port: 5949, arguments: '[
	5949
]', nc-server.json: '[]'. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

nc_server: debugLevel(0):0  port(5959):5949  closeConnection(0):0. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

1. Loading plugin: nc/worker/auth_worker. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

2. Loading plugin: nc/worker/query_worker. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

3. Loading plugin: nc/worker/query4d_worker. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

4. Loading plugin: nc/worker/call4d_worker. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

All plugins have been loaded. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

* cached preference files: demo-fi_demo-0 - table/prf/field_type.json, demo-fi_demo-0 - system/4d.json, demo-fi_demo-0 - system/option.json. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

* run in command line: 'ifconfig | grep -E 'inet.[0-9]' | grep -v '127.0.0.1' | awk '{ print $2}''. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

* run in command line: 'LC_ALL=C ifconfig en0 | awk '/ether/{print $2}''. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

Mac address: f84d896921dc. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

TLS certificate files: /Users/pasi/nc/nc-server/preference/cert/cert.pem, /Users/pasi/nc/nc-server/preference/cert/privkey.pem. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

NC tcp server waiting on:  http://127.0.0.1:5949/,  http://192.168.32.2:5949/
                          https://127.0.0.1:5949/, https://192.168.32.2:5949/. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

NC udp server waiting on: 127.0.0.1:5949/, 192.168.32.2:5949/. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

--- server started in 0.0056 seconds, 2022-01-23 23:42:25, used memory 3095.1 kb --- 	 5. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

OSX arm64, using: rapidjson-arm, lfs-ffi. 	23.1.2022 	23:42:25 	lx 	(5. palvelin)

1. uri: HTTP, POST '/rest/nc/query/sql4d' 2022-01-23 23:57:34
'POST /rest/nc/query/sql4d HTTP/1.1
Content-Type: application/json
Connection: keep-alive
User-Agent: nc-rest-sql
Authorization: Basic ???
Content-Encoding: lz4
Accept-Encoding: lz4
Content-Length: 919
Content-Uncompressed-Length: 1429

LZ4. 	23.1.2022 	23:57:34 	lx 	(5. palvelin)

* load upper level nc-preference file: '/Users/pasi/nc/nc-server/../nc-preference/.nc-env.json'. 	23.1.2022 	23:57:34 	lx 	(5. palvelin)

    Connected to: 'Manageri v12 plg4d local, , database: plg4d, user: manage_demo'. 	23.1.2022 	23:57:34 	lx 	(5. palvelin)

  database connect time: 0.0002 seconds. 	23.1.2022 	23:57:34 	lx 	(5. palvelin)

* connect: connection changed from 'postgre-demo/fi_demo' to 'plg4d/plg4d'. 	23.1.2022 	23:57:34 	lx 	(5. palvelin)

4D: SELECT inv.record_id FROM invoice inv WHERE inv.company_id IN ('1057') INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv  WHERE inv.company_id IN ('1057')  ORDER BY inv.invoice_id  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
 - result _lx_atExe1 size: 127, first value: '1300969'
 - query name: new:form/nc/erp-sync/query/order-invoice.json. 	23.1.2022 	23:57:34 	_lx_ExecuteSqlNew 	(5. palvelin)

 1. answer time: 00:00:00.00516
  
SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id
 FROM invoice inv
 WHERE inv.company_id IN ('1057')
 ORDER BY inv.invoice_id. 	23.1.2022 	23:57:34 	lx 	(5. palvelin)

4D: SELECT inv.record_id FROM invoice inv WHERE inv.company_id IN ('1057') INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv  WHERE inv.company_id IN ('1057')  ORDER BY inv.invoice_id  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
 - result _lx_atExe1 size: 127, first value: '1300969'
 - query name: new:form/nc/erp-sync/query/order-invoice.json. 	23.1.2022 	23:57:36 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT inv.record_id FROM invoice inv WHERE inv.company_id IN ('1057') INTO :_lx_atExe1
 - original query: SELECT inv.invoice_id, inv.your_reference, inv.customer_project, inv.state, inv.company_id, inv.date_, inv.due_date, inv.price_total, inv.vat_total, inv.currency_id, inv.terms_of_payment_id, inv.invoice_text, inv.type_, inv.record_id FROM invoice inv  WHERE inv.company_id IN ('1057')  ORDER BY inv.invoice_id  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_alExe1,:_lx_atExe4,:_lx_adExe1,:_lx_adExe2,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8,:_lx_atExe9
 - result _lx_atExe1 size: 127, first value: '1300969'
 - query name: new:form/nc/erp-sync/query/order-invoice.json. 	23.1.2022 	23:58:04 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT so.record_id FROM sales_order so WHERE so.project_id <> '' LIMIT 500 INTO :_lx_atExe1
 - original query: SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id FROM sales_order so  WHERE so.project_id <> ''  ORDER BY so.sales_order_id DESC  LIMIT 500  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8
 - result _lx_atExe1 size: 500, first value: '2001066'
 - query name: new:form/nc/erp-sync/woocommerce/query-local/order-sales.json. 	23.1.2022 	23:58:25 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 4, send count: 5, loop count: 4, bytes sent 340975 / 340975, 0 remaining, total send time 410 µs. 	23.1.2022 	23:58:25 	lx 	(5. palvelin)

4D: SELECT so.record_id FROM sales_order so WHERE so.project_id <> '' LIMIT 500 INTO :_lx_atExe1
 - original query: SELECT so.sales_order_id, so.project_id, so.state, so.company_id, so.sales_price_total, so.vat_total, so.currency_id, so.notes, so.additional_data, so.record_id FROM sales_order so  WHERE so.project_id <> ''  ORDER BY so.sales_order_id DESC  LIMIT 500  INTO :_lx_atExe1,:_lx_atExe2,:_lx_atExe3,:_lx_atExe4,:_lx_arExe1,:_lx_arExe2,:_lx_atExe5,:_lx_atExe6,:_lx_atExe7,:_lx_atExe8
 - result _lx_atExe1 size: 500, first value: '2001066'
 - query name: new:form/nc/erp-sync/woocommerce/query-local/order-sales.json. 	23.1.2022 	23:58:30 	_lx_ExecuteSqlNew 	(5. palvelin)

 -- tcp answer 5, send result: -1, send count: 1, loop count: 1, bytes sent 81660 / 340973, 259313 remaining, total send time 4 µs. 	23.1.2022 	23:58:30 	lx 	(5. palvelin)

 -- tcp answer 5, send result: -1, send count: 2, loop count: 3, bytes sent 163320 / 340973, 177653 remaining, total send time 1265 µs. 	23.1.2022 	23:58:30 	lx 	(5. palvelin)

 -- tcp answer 5, send result: -1, send count: 4, loop count: 6, bytes sent 310308 / 340973, 30665 remaining, total send time 2533 µs. 	23.1.2022 	23:58:30 	lx 	(5. palvelin)

 -- tcp answer 5, send count: 5, loop count: 7, bytes sent 340973 / 340973, 0 remaining, total send time 3810 µs. 	23.1.2022 	23:58:30 	lx 	(5. palvelin)

4D: SELECT _prf.record_id FROM _preference _prf WHERE name_id = '_code_SiteCode' INTO :_lx_atExe1
 - original query: SELECT text_value FROM _preference WHERE name_id = '_code_SiteCode'  INTO :_lx_atExe1
 - result _lx_atExe1 size: 1, first value: 'ZZY0'
 - query name: new:dsql.sqlExecuteUnsafe. 	23.1.2022 	23:58:42 	_lx_ExecuteSqlNew 	(5. palvelin)

4D: SELECT _prf.record_id FROM _preference _prf WHERE name_id = 'code_default.json' INTO :_lx_atExe1
 - original query: SELECT text_value FROM _preference WHERE name_id = 'code_default.json'  INTO :_lx_atExe1
 - result _lx_atExe1 size: 1, first value: '{
  "code": {
    "_CODE_ALFLD": [4002, 4002, 4002, 4013, 4013, 4013, 8011, 8011, 10004, 11005, 17004, 17004, 17004, 17004, 17004, 17004, 21001, 21001, 21001, 21001, 21001, 21001, 26002, 27001, 28008, 28008, 29001, 29001, 31001, 31001, 31011, 32002, 32002, 33001, 37001, 37001, 42001, 43002, 44012, 44031, 44031, 44032, 48036, 50001, 54001],
    "_CODE_ASFLDNAME": ["[Tosite]TUNNUS", "[Tosite]Tosite ID", "[Tosite]TUNNUS", "[Tosite]Tositenumero", "[Tosite]Tositenumero", "[Tosite]Tositenumero", "[Var'
 - query name: new:dsql.sqlExecuteUnsafe. 	23.1.2022 	23:58:43 	_lx_ExecuteSqlNew 	(5. palvelin)

warning: 
*** sql error: '', sql: 
INSERT INTO sales_order
 (company_id, customer_order_number, currency_id, delivery_address, delivery_company_id, invoicing_address, invoicing_company_id, additional_data, notes, order_address, sales_order_id, state, type_, employee_id, sales_price_total, project_id, record_id, terms_of_payment_id, vat_total)
 VALUES ('7000', '', 'EUR', 'Automaatti K-Citymarket Nummela
Tuusankaari 1
03100 Nummela', '7000', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela
0407460885, orau@windowslive.com', '7000', '{
  "fee_lines": [],
  "shipping": {
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "city": "Nummela",
    "address_1": "Hopeasepäntie 9 as 3",
    "address_2": "",
    "company": "",
    "postcode": "04109",
    "state": "",
    "country": "FI"
  },
  "refunds": [],
  "_links": {
    "collection": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders"
      }
    ],
    "self": [
      {
        "href": "https://shop.va-varuste.fi/wp-json/wc/v3/orders/5911"
      }
    ]
  },
  "payment_method_title": "Paytrail",
  "date_paid": "2021-10-04T16:09:38",
  "date_paid_gmt": "2021-10-04T13:09:38",
  "date_completed": "2021-10-08T07:01:57",
  "date_completed_gmt": "2021-10-08T04:01:57",
  "cart_hash": "7e27f29f09e9998f020ba75c1cd30fd0",
  "currency": "EUR",
  "meta_data": [
    {
      "value": "no",
      "key": "is_vat_exempt",
      "id": 241915
    },
    {
      "value": "6277",
      "key": "_woo_carrier_agent_id",
      "id": 242117
    },
    {
      "value": {
        "title": "Automaatti K-Citymarket Nummela",
        "city": "Nummela",
        "street_address2": "",
        "street_address": "Tuusankaari 1",
        "id": "6277",
        "distance": "0.1",
        "carrier": "matkahuolto",
        "postcode": "03100",
        "logo_url": "",
        "country": "FI"
      },
      "key": "_woo_carrier_agent_meta",
      "id": 242119
    },
    {
      "value": "O:8:\"stdClass\":9:{s:15:\"shipment_number\";s:13:\"MH230496941FI\";s:6:\"weight\";d:0.200000000000000011102230246251565404236316680908203125;s:8:\"packages\";s:1:\"1\";s:12:\"product_code\";s:2:\"80\";s:15:\"activation_code\";s:0:\"\";s:16:\"special_handling\";s:0:\"\";s:3:\"cod\";b:0;s:10:\"cod_amount\";N;s:13:\"cod_reference\";N;}",
      "key": "_wc_matkahuolto",
      "id": 242120
    }
  ],
  "parent_id": 0,
  "total": "20.50",
  "total_tax": "3.97",
  "shipping_lines": [
    {
      "meta_data": [
        {
          "value": "Serafil 20 Beige 0267 WR &times; 1",
          "key": "Tuotteet",
          "id": 53885
        }
      ],
      "method_title": "Matkahuolto Lähellä-paketti",
      "id": 7281,
      "instance_id": "5",
      "method_id": "matkahuolto",
      "taxes": [
        {
          "total": "1.452",
          "id": 1,
          "subtotal": ""
        }
      ],
      "total_tax": "1.45",
      "total": "6.05"
    }
  ],
  "transaction_id": "b9b5739bc0",
  "order_key": "wc_order_5u5kiQdAERF01",
  "created_via": "checkout",
  "date_created_gmt": "2021-10-04T13:08:10",
  "status": "completed",
  "date_modified_gmt": "2021-10-08T04:01:57",
  "discount_tax": "0.00",
  "customer_id": 0,
  "shipping_tax": "1.45",
  "cart_tax": "2.52",
  "version": "3.6.2",
  "prices_include_tax": false,
  "discount_total": "0.00",
  "billing": {
    "first_name": "Olli",
    "last_name": "Rautiainen",
    "city": "Nummela",
    "address_1": "Hopeasepäntie 9 as 3",
    "email": "orau@windowslive.com",
    "address_2": "",
    "phone": "0407460885",
    "state": "",
    "postcode": "04109",
    "company": "",
    "country": "FI"
  },
  "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A525F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/15.0 Chrome/90.0.4430.210 Mobile Safari/537.36",
  "shipping_total": "6.05",
  "customer_note": "",
  "customer_ip_address": "185.166.28.117",
  "number": "5911",
  "id": 5911,
  "date_modified": "2021-10-08T07:01:57",
  "date_created": "2021-10-04T16:08:10",
  "line_items": [
    {
      "meta_data": [],
      "name": "Serafil 20 Beige 0267 WR",
      "quantity": 1,
      "price": 10.48,
      "product_id": 2149,
      "total_tax": "2.52",
      "subtotal": "10.48",
      "subtotal_tax": "2.52",
      "tax_class": "",
      "id": 7280,
      "variation_id": 0,
      "total": "10.48",
      "taxes": [
        {
          "total": "2.5152",
          "id": 1,
          "subtotal": "2.5152"
        }
      ],
      "sku": "RE_LASERA20B0267"
    }
  ],
  "tax_lines": [
    {
      "rate_id": 1,
      "shipping_tax_total": "1.45",
      "id": 7282,
      "label": "alv.",
      "rate_code": "FI-ALV.-1",
      "meta_data": [],
      "tax_total": "2.52",
      "compound": false
    }
  ],
  "coupon_lines": [],
  "payment_method": "paytrail"
}', '', 'Rautiainen Olli
Hopeasepäntie 9 as 3
04109 Nummela', '5911', 'AV', 'TI', 'HV', 16.53, '', '20220123.235842.gr001.so_  zzy9f84d896921dcrr', 'K', 3.97)


. 	23.1.2022 	23:58:43 	lx 	(5. palvelin)

